RB-004
Roblox disappearing platform script
A platform that fades away after someone steps on it, then comes back.
- Script type
- Script
- Where it goes
- Inside the Part
- Category
- World and effects
For your own game in Roblox Studio. Not for use in other people's games.
The code
-- Disappearing platform: touched -> short delay -> gone -> comes back.
local DELAY_BEFORE_FALL = 1 -- seconds after the touch before it vanishes
local TIME_GONE = 3 -- seconds it stays invisible
local FADE_TIME = 0.4 -- seconds the fade takes
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local platform = script.Parent
local active = false
platform.Touched:Connect(function(hit)
if active then
return
end
if not Players:GetPlayerFromCharacter(hit.Parent) then
return
end
active = true
task.wait(DELAY_BEFORE_FALL)
local fadeOut = TweenService:Create(platform, TweenInfo.new(FADE_TIME), { Transparency = 1 })
fadeOut:Play()
fadeOut.Completed:Wait()
platform.CanCollide = false
task.wait(TIME_GONE)
platform.CanCollide = true
local fadeIn = TweenService:Create(platform, TweenInfo.new(FADE_TIME), { Transparency = 0 })
fadeIn:Play()
fadeIn.Completed:Wait()
active = false
end)How to set it up
- Insert a Part and set Anchored to true.
- Add a Script inside the Part and paste the code.
- Copy and paste the whole part to make a row of platforms. Each copy keeps its own script.
- Play and walk across them.
Change it
- Make DELAY_BEFORE_FALL smaller for a harder obby.
- The platform stays at Transparency 0 when it returns. If your part was already see-through, change the 0 to its old value.
- Only players trigger it. Loose parts and NPCs do not.
More in World and effects
More Roblox tools
- Shirt and pants templatesFree Roblox clothing templates to download: hoodies, jerseys, jeans, joggers and more.
- Robux tax calculatorWork out what you receive after the marketplace fee, or what to charge.
- Robux to USD calculatorConvert earned Robux to dollars at a DevEx rate you can edit.
- Shirt and pants template makerColour each panel of the 585×559 clothing template and download it.
- Username generatorGenerate usernames that fit the 3–20 character rule.