I'm making an obby, just for fun, and I have this script to change the transparency of these parts.
Here it is:
local translvl = .1
function transpar(part)
while true do
if part.Transparency >= 1 then
part.Transparency = part.Transparency - translvl
elseif part.Transparency <= 0 then
wait(3)
part.Transparency = part.Transparency + 1
end
end
wait(.1)
end
for _,parts in pairs(script.Parent:GetChildren()) do
if parts.Name == "Part" then
transpar(parts)
end
end
So I'm trying to make it so the parts inside the model turn visible, don't do anything for 3 seconds and then slowly turn invisible again. Now I my game freezes and points to line 5. Any idea why this loop is running so many times?
Hope you can help and even if you can't thank you for your time.

3 comments
The Transparency of a BasePart cannot go over 1. Make >= 1 to == 1
I've found it can if you are doing a while loop of a variable and adding that to the transparency actually.
I think you meant to do 'if part.Transparency > 0 then', not 'if part.Transparency >= 1 then'