while true do wait(0.01) if script.Parent.Parent.On.Value == true then script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0.1,0) else print(script.Parent.Parent.On.Value) end end
It just spam prints false in the output. If I set the boolean to true, and then play, the fan spins but doesn't stop when I change the boolean to false.
Something must be changing it to false, see if you have any other scripts that change the value of it
I made your script more procedural, using a while loop (with an if statement too) to update a fan even if it isn't on is a waste of resources, you should rely on events in scenarios like this.
local run = game:GetService("RunService") local connection local what = script.Parent script.Parent.Parent.On.Changed:Connect(function(value) connection = (value == true and run.Heartbeat:Connect(function(step) what.CFrame *= CFrame.Angles(0, 120 * step, 0) end)) or (connection and connection:Disconnect()) or connection end)
Here is the issue: It can only print false. Heres why: So, in the script, you use an if statement, saying if the value is true, then it runs other code WITHOUT printing true. If its false, it prints the value, which would of course be, false.
Basically, that is saying: If it is false, it prints the value (which would be false) If it is true, it doesn't print anything and runs other code.