How to Make Opening Doors in Roblox Studio

avatarHouselingMoon2 years ago
Best Answer
avatarNailingSurge2 years ago

Hey there! To make a door open in Roblox Studio, you can use a script that changes the position or transparency of the door part. Just insert a part, name it 'Door', and add a Script (not a LocalScript) to it with some simple code. Here's a basic example:

```lua

local door = script.Parent

local open = false

function openDoor()

if not open then

door.Transparency = 0.5

door.CanCollide = false

open = true

else

door.Transparency = 0

door.CanCollide = true

open = false

end

end

script.Parent.Touched:Connect(openDoor)

```

Play Games.Earn points.Get gift cards!

PB

PB

Playback Rewards

4.5 Star Rating(13.7k)
Silly Arrow
User avatarUser avatarUser avatarUser avatar

500k players and counting...

More Answers

avatarQuestioningVale2 years ago

Just use a ClickDetector with a simple script, like this:

```lua

script.Parent.ClickDetector.MouseClick:Connect(function()

script.Parent.Transparency = 0.5

script.Parent.CanCollide = false

end)

``` Done!


avatarMisleadingBride2 years ago

Alright, let's do this simply. Insert a part for your door, then add a ClickDetector and a script to it. This script will toggle the door's position:

```lua

local door = script.Parent

local open = false

function toggleDoor()

if not open then

door.Position = door.Position + Vector3.new(0, 0, 5)

open = true

else

door.Position = door.Position - Vector3.new(0, 0, 5)

open = false

end

end

script.Parent.ClickDetector.MouseClick:Connect(toggleDoor)

```


avatarAttendingStoke2 years ago

Honestly, you could probably just move the door out of the way on touch using a tween service for extra smoothness. But hey, don't forget to anchor it!


avatarBeatingDebit2 years ago

Been doing this for ages. Easiest way: place a ClickDetector in the door part, then use a script to change its transparency and collision properties when clicked. Works like a charm every time!

馃憖 If you like Doors...

avatarDiego3 hours ago
If you're a Roblox player looking for extra robux, you need to download the Playbite app!

Playbite is like an arcade in your phone: you get to play all kinds of fun and simple games, compete with friends and others, and win cool prizes from all your favorite brands!

One of those prizes is the official Roblox gift card, which you can win and use to get robux essentially for free!

In case you鈥檙e wondering, this is how it works: 

Playbite makes money from (not super annoying) ads and (totally optional) in-app purchases. The app then uses that money to reward players like you with prizes!

Download Playbite for free, available on the App Store and Play Store!

The brands referenced on this page are not sponsors of the rewards or otherwise affiliated with this company. The logos and other identifying marks attached are trademarks of and owned by each represented company and/or its affiliates. Please visit each company's website for additional terms and conditions.

Add an Answer