Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Made by coolcapidog
- Channel ->> https://www.youtube.com/c/coolcapidog
- ]]
- local TweenService = game:GetService("TweenService")
- local hinge = script.Parent.PrimaryPart
- local prompt = script.Parent.Base:FindFirstChildOfClass("ProximityPrompt")
- local Sound = nil
- if script.Parent.Base:FindFirstChildOfClass("Sound") then
- Sound = script.Parent.Base:FindFirstChildOfClass("Sound")
- end
- local goalOpen = {}
- goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)
- local goalClose = {}
- goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)
- local tweenInfo = TweenInfo.new(1)
- local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
- local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)
- prompt.Triggered:Connect(function()
- prompt.Enabled = false
- if prompt.ActionText == "Close" then
- tweenClose:Play()
- prompt.ActionText = "Open"
- else
- tweenOpen:Play()
- prompt.ActionText = "Close"
- end
- if Sound ~= nil then Sound:Play() end
- wait(1)
- prompt.Enabled = true
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement