Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

my ClickDetector button script not working what do i do?

i have a script for a clicky brick thats supposed to change a BoolValue and im not sure why it isnt working but i still am quite a noob so im not sure


local s = script.Parent
local val = workspace.GameData.Close



function setval()
	s.Color = BrickColor.new("Lime green")
	val.Value = true
	wait(0.5)
	s.Color = BrickColor.new("Really red")
end

s.CD.MouseClick:Connect(setval)

2 comments

0

What class is Close?

0

are there any errors from the output?

1 answer

✓ Accepted answer
-- Server Script

local Part = script.Parent -- Part where the ClickDetector is
local ClickDetector = Part.ClickDetector -- Our click ClickDetector
local val = workspace.GameData.Close -- Our closed check

ClickDetector.MouseClick:Connect(function()
	Part.BrickColor = BrickColor.new("Lime green") -- Sets to lime green
	val.Value = true -- Sets the val to true
	wait(.5) -- .5 delay
	Part.BrickColor = BrickColor.new("Really red") -- Sets to really red
end)

Hope this works.

This discussion is preserved as it was. New answers, comments, and votes are closed.