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

What's wrong here / Why is the script not repeating properly? Is it broken?

Asked by
v6_g 0
4 years ago

Here's the script : [Named TurnL]

while true do
    script.Parent.TurnLF.BrickColor = BrickColor.new("Br. yellowish orange")
    script.Parent.TurnLF.SpotLight.Enabled = true
    wait ()
    script.Parent.TurnLF.BrickColor = BrickColor.new("Really black")
    script.Parent.TurnLF.SpotLight.Enabled = false
end

Here's the script that will Activate it. [A Script inside a block, Inside a model to activate TurnL.]

on = false
script.Parent.ClickDetector.MouseClick:connect(function(click)
if on == false then
on = true
script.Parent.Parent.TurnL.Disabled = false
else
on = false
script.Parent.Parent.TurnL.Disabled = true
end
end)

[TurnLF Is Spelled properly, TurnLF has the SpotLight in it, It's in the correct location.]

I have a separate clickdetector with a script in it which activates this script, Clicking again will deactivate it. However, it decides not to loop when activated and only changes the BrickColor and turns on the SpotLight?

How would i get it to Properly loop when the script is activated? I've tried everything I could think of to fix it. Even tried messing around with Script + Block Names.

0
The script is working but I think its cause you added "wait()" in the brackets you didnt type any numbers cause if you just wait for zero seconds its not gonna look like anything has changed. if you want it to quickly change then just change it to wait(0.1) or something like that. bx3t 2 — 4y

1 answer

Log in to vote
0
Answered by
Robowon1 323 Moderation Voter
4 years ago
Edited by royaltoe 4 years ago

The problem is that you have no wait between switching colours at the end of the loop before it loops again(so there is no noticeable difference)

fix)


while true do script.Parent.TurnLF.BrickColor = BrickColor.new("Br. yellowish orange") script.Parent.TurnLF.SpotLight.Enabled = true wait () script.Parent.TurnLF.BrickColor = BrickColor.new("Really black") script.Parent.TurnLF.SpotLight.Enabled = false wait() end
Ad

Answer this question