Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Parent: a platform part
- --Trigger: when the platform is stepped on or touched
- --Result: after a delay, the platform will begin to disappear
- local initialDelay = 1 --how long it takes before the platform starts to disappear
- local disappearingSpeed = 1 --how fast it takes for the platform to disappear
- local respawnDelay = 2 --how long it takes for the platform to reappear after disappearing
- local platform = script.Parent --reference to the platform part
- local isTouched = false --if the platform has been touched or not, debounce
- local function platformTouched()
- if isTouched then
- return
- end
- isTouched = true
- task.wait(initialDelay)
- for i=1,10,1 do
- platform.Transparency += 0.1
- task.wait(disappearingSpeed/10)
- end
- platform.CanCollide = false
- task.wait(respawnDelay)
- platform.CanCollide = true
- platform.Transparency = 0
- isTouched = false
- end
- platform.Touched:Connect(platformTouched)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement