Roblox door script
A door that slides open and closed. Players press E, or tap the prompt on a phone.
Where it goes
- 1Add a Part for the door and turn on Anchored. Make it wider than it is thick, along its X side.
- 2Hover over it in the Explorer, press + and choose Script.
- 3Delete what's in the Script, paste this in and press Play. Walk up to it and press E.
-- From forja.us/tools/roblox-scripts/door-- A door that slides open and closed with a prompt.local TweenService = game:GetService("TweenService")local door = script.Parentlocal closed = door.CFramelocal open = closed * CFrame.new(door.Size.X, 0, 0)local slide = TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)local prompt = Instance.new("ProximityPrompt")prompt.ActionText = "Open"prompt.ObjectText = "Door"prompt.Parent = doorlocal isOpen = falseprompt.Triggered:Connect(function() isOpen = not isOpen prompt.ActionText = isOpen and "Close" or "Open" TweenService:Create(door, slide, { CFrame = isOpen and open or closed }):Play()end)How it works
- A
ProximityPromptshows the "press E" button when a player is close, on every device. CFrame.new(door.Size.X, 0, 0)is one door's width to the side, so it slides clear of the opening.TweenServicemoves it smoothly instead of jumping.
Make it yours
- Slide the other way
- Use
-door.Size.X. - Close by itself
- After
Play(), addtask.wait(3)and close it again.
Maps to try it on: horror maps
Start from a finished map, and your scripts have a game to run in.
More free Roblox scripts
Roblox kill brick scriptRoblox leaderboard scriptRoblox save data scriptRoblox sprint scriptRoblox double jump scriptRoblox teleport scriptRoblox obby checkpoint scriptRoblox coin pickup scriptRoblox day and night cycle scriptRoblox game pass scriptRoblox developer product scriptRoblox tool giver scriptRoblox round system scriptRoblox background music scriptRoblox speed pad scriptRoblox jump pad scriptRoblox VIP door scriptRoblox daily reward scriptRoblox NPC dialogue scriptRoblox pet follow scriptRoblox gun scriptRoblox admin commands scriptRoblox tycoon dropper scriptRoblox shop GUI script

