I am building an obby, and one of the stages is where there are multiple platforms, that when touched by the player, fade away and disappear (Transparency = 1 and canCollide = false). However, when the player touches the platform, after fading away, the player can still stand and walk on the platform for multiple seconds. Also, I am new to scripting, so I am sorry if this is a very obvious problem. Here is the code that I used:
local p = script.Parent
function onTouch(part)
for i=1,100 do
p.Transparency = p.Transparency + 0.01
wait(0.01)
end
p.CanCollide = false
wait(2.5)
p.Transparency= 0
p.CanCollide = true
end
p.Touched:connect(onTouch)

3 comments
After deleting the for loop and replacing it with the Tween Service, it worked. Thanks so much!
You are welcome
I guess that works too.