Log in to vote
0

# Render Connection won't Disconnect after false?

Asked by
TechModel 118
13 days 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.

local v == true

if v == true then
local c
c = game:GetService("RunService").RenderStepped:Connect(function()
Part.Color = Color3.fromHSV(tick() % 25 / 25, 1, 1)
if v == false then
c:Disconnect()
end
end)
end


### 1 answer

Log in to vote
0
Answered by
TechModel 118
12 days 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