Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Can i add sound to door when i open? (using ProximtityPrompt)

Asked by 3 years ago
Edited 3 years ago
 local TweenService = game:GetService("TweenService")

local hinge = script.Parent.Doorframe.Hinge
local prompt = script.Parent.Base.ProximityPrompt

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()
    if prompt.ActionText == "Close" then
        tweenClose:Play()
        prompt.ActionText = "Open"
    else
        tweenOpen:Play()
        prompt.ActionText = "Close"
    end
end)
0
add a close sound and open sound and put it into the script. Then make a variable of the two, name it whatever you want. in the connect:function(), closeSound:Play() if it is open and openSound:Play() if it is closed XObbyCreatorX 38 — 3y

Answer this question