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

Render Connection won't Disconnect after false?

Asked by
TechModel 118
2 years ago

I'm just trying to get a rainbow effect and toggling it using v variable wont even disable it. After v == true it is looped forever. How can I fix this? I even searched the web and It still does not help, putting disconnect in the connection loop.

01local v == true
02 
03if v == true then
04    local c
05    c = game:GetService("RunService").RenderStepped:Connect(function()
06        Part.Color = Color3.fromHSV(tick() % 25 / 25, 1, 1)
07        if v == false then
08            c:Disconnect()
09        end
10    end)
11end

1 answer

Log in to vote
0
Answered by
TechModel 118
2 years ago

I found the solution. The variable inside the function inside the function can't be changed to disconnect. Instead I put the v outside the function

Ad

Answer this question