I am trying to make when you click a button the x goes red like on the got talent show.
This is my script
I am trying to make when you click a button the x goes red like on the got talent show.
You should have a local for the variables button and X2.
Issue is you have not done the event correctly. You can’t have an if statement in it.
oh yeah thank you, i am not a scripter so i just tried it.
You can’t have if statements while connecting an event. You should be connecting it a function.
So remove
if then
end
and change it with
Button.ClickDetector.MouseClick:Connect(function()
end)
Hi, you should always localize your variables. Also, this is how you properly set up a connection on an event.
local Button = script.Parent
local X2 = workspace.X2
X2.ClickDetector.MouseClick:Connect(function()
X2.Part1.BrickColor = BrickColor.new('Really red')
X2.Part.BrickColor = BrickColor.new('Really red')
end)
It would not work because there’s no function try this
local Part = script.Parent
local ClickDetector = Part.ClickDetector
ClickDetector.MouseClick:Connect(function()
Part.BrickColor = BrickColor.new('Black')
end)