Hello Developers
I have currently faced a very weird problem in my script, I don’t know why or how this is happening.
-the problem is when I Writing a while loop then break it the loop should stop but its not its keep going for ever.
- im trying to make a part that when you touch it the transparency goes from 0 to 1 on a loop then after that the Cancollide is gonna turn from true to false and after 2 seconds every thing is gonna return back to normal
this is the script
local Debouce = false
local Idk = coroutine.create(function()
while true do
wait(0.8)
script.Parent.Transparency = script.Parent.Transparency + 0.1
if script.Parent.Transparency == 1 then
break
end
end
end)
script.Parent.Touched:Connect(function(hit)
if not Debouce then
if hit.Parent:FindFirstChild("Humanoid") then
coroutine.resume(Idk)
wait(0.9)
script.Parent.CanCollide = false
wait(2)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
wait(.45)
Debouce = true
end
end
end)
– can anyone tell me why this is happing and how do I fix this?