#brick color change client side
1 messages · Page 1 of 1 (latest)
Make it a local script then
Also put the local script in StarterGui/StarterCharacterScripts/StarterPlayerScripts
Dont put it in wirkspace
As local scripts doesnt works in workspace
They only work when related to player
Or in a player/character
so basically il put the script that turns part to green when touched to starterplayerscripts
yes
as local scripts usually dont work in workspace or tend to be unreliable
i only need to create 1 right
yeah
didn't work at all
you have to change up the script im assuming you have it in the part you touch so it wont work just moving it to starterplayerscripts you need to also move the code into a client script on roblox is LocalScript but client script makes more sense anyways after that you put it in starterplayerscripts and you have to redo the code to work from there not from inside the part itself
-- Put this script inside the part you want to change color
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local part = script.Parent
local originalColor = part.Color
local touchedColor = Color3.fromRGB(42, 255, 42) -- Lime green
local hasTouched = {}
local function onTouch(hit)
local character = hit.Parent
local player = Players:GetPlayerFromCharacter(character)
if player and not hasTouched[player.UserId] then
hasTouched[player.UserId] = true
-- Change color for this player only
local originalColor = part.Color
part.Color = touchedColor
-- Create effect
local effectPart = Instance.new("Part")
effectPart.Size = part.Size
effectPart.CFrame = part.CFrame
effectPart.Anchored = true
effectPart.CanCollide = false
effectPart.Transparency = 0.6
effectPart.Material = Enum.Material.Neon
effectPart.Color = touchedColor
effectPart.Parent = workspace
local goalSize = part.Size + Vector3.new(6, 0, 6)
local tweenInfo = TweenInfo.new(0.6, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local tween = TweenService:Create(effectPart, tweenInfo, {Size = goalSize})
tween:Play()
tween.Completed:Connect(function()
local fadeTween = TweenService:Create(effectPart, TweenInfo.new(0.3), {Transparency = 1})
fadeTween:Play()
fadeTween.Completed:Connect(function()
effectPart:Destroy()
end)
end)
end
end
part.Touched:Connect(onTouch)
Players.PlayerRemoving:Connect(function(player)
hasTouched[player.UserId] = nil
end)
is this a script or local script
script
** You are now Level 1! **
yo i Just made it worked finnally shits took me along time🥹