Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What Is Wong With My Light Script?

Asked by 9 years ago

It's not flashing every second as I want it to do. I'm not sure what I am doing wrong it just wont flicker... Thanks for helping!

RedButton1 = game.Workspace.RedButton.PointLight.Enabled

while true do
    RedButton1 = true
    wait(1)
    RedButton1 = false
    wait(1)
end

1 answer

Log in to vote
1
Answered by
Redbullusa 1580 Moderation Voter
9 years ago

You can't set a variable directly to a property. You'll only receive the value of the property.

RedButton1 = game.Workspace.RedButton.PointLight.Enabled
print(RedButton1)               -- Output: "false" rather than the property name

while true do
    RedButton1 = true
    wait(1)
    RedButton1 = false
    wait(1)
end

To fix this, just have a variable of the object instead.

RedButton1 = game.Workspace.RedButton.PointLight
print(RedButton1)               -- Output: "PointLight"

while true do
    RedButton1.Enabled = true
    wait(1)
    RedButton1.Enabled = false
    wait(1)
end
0
Thank you so much mechasaultfreak2 10 — 9y
0
You're welcome. Redbullusa 1580 — 9y
Ad

Answer this question