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

I can't get a flashing light to turn on when clicked?

As you may know from my previous post I am trying to make a game with cars in but one problem I am "suffering" from is that I am using a light where when you click it should flash.

while true do
script.Parent.ClickDetector.MouseClick:Connect(function()
script.Parent.Material = ("Neon")
wait(.5)
script.Parent.Material = ("Plastic")
end

please help me!

hierachy: Blue ClickDetector Script

as simplified

4 comments

0

Edited for code block.

0
  1. You need an "end)" for the function. 2) Swap the "while true do" and the function.
0

You shouldn't need the while loop at all

0

This is just put together badly.

1 answer

Okay...let me start with problem one you have missing ends there should be an end). Problem 2 switch while true do and the function if you do that you are binding a function to a loop which isn't a good idea.So this it how it should look like.

script.Parent.ClickDetector.MouseClick:Connect(function()
while true do
script.Parent.Material = ("Neon")
wait(.5)
script.Parent.Material = ("Plastic")
end
end)

If you don't understand why it didn't work before ask in comments.

2 comments

0

i didnt understand please send me a message on roblox explaining thank you good friend im 12 i think thats why

0

it doesnt work btw

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