Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --script requirements:
- ----a door part
- ----a transparent placeholder part where you want the door to move to when opening
- ------just duplicate the door, move it, and rename it
- ----2 buttons (inside and outside), and each with a proximity prompt
- --Change these references to match your objects in the explorer
- local door = script.Parent.door
- local placeholder = script.Parent.placeholder
- local proxpro1 = script.Parent.button1.ProximityPrompt
- local proxpro2 = script.Parent.button2.ProximityPrompt
- local closed = true
- local duration = 4
- local tweenservice = game:GetService("TweenService")
- local tweeninfo = TweenInfo.new(duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
- local close = tweenservice:Create(door, tweeninfo, {CFrame = door.CFrame})
- local open = tweenservice:Create(door, tweeninfo, {CFrame = placeholder.CFrame})
- proxpro1.Triggered:Connect(function()
- proxpro1.Enabled = false
- proxpro2.Enabled = false
- if closed then
- open:Play()
- wait(duration)
- closed = false
- else
- close:Play()
- wait(duration)
- closed = true
- end
- proxpro1.Enabled = true
- proxpro2.Enabled = true
- end)
- proxpro2.Triggered:Connect(function()
- proxpro1.Enabled = false
- proxpro2.Enabled = false
- if closed then
- open:Play()
- wait(duration)
- closed = false
- else
- close:Play()
- wait(duration)
- closed = true
- end
- proxpro1.Enabled = true
- proxpro2.Enabled = true
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement