I’m sorry, I rewrote, I meant part
Ah, the color to change? Try this in the part that needs to be touched:
local function changeOnTouch(PartToChange, Color)
game.Workspace:WaitForChild(PartToChange).Color = Color3.fromRGB(Color)
end
script.Parent.Touched:Connect(function()
changeOnTouch(game.Workspace:WaitForChild(""), {255, 255, 255}) -- Add the name of the object in the WaitForChild quotes, and change the Color3 value to your liking!
end)
1 Like
I’m sorry, but it doesn’t work, anyway, thank you very much for your help, I’ll try to figure it out
1 Like
It’s somewhere along the line of that, if it didn’t work, try removing the color code from the function, and just adding it into the Color3 within the function.
1 Like
If u want to have Part B color changed when Part A is touched all u gotta do is
local PartA = script.Parent
local PartB = workspace.PartB
local debounce = false
local function onTouch()
if not debounce then
debounce = true
PartB.Color = Color3.fromRGB(76, 255, 62)
task.wait(3)
PartB.Color = Color3.fromRGB(250, 0, 0)
debounce = false
end
end
PartA.Touched:Connect(onTouch)
Thank you so much, bit i already solved this