You can write your topic however you want, but you need to answer these questions:
-
What do I want to achieve?
A Openable door using proximity prompts that doesn’t only work in Studio -
What is the issue?
I made a door that opens and closes using proximity prompts, but it only works in Roblox Studio, and does not work in Roblox
Roblox Studio:
Roblox:
- What solutions have I tried so far?
- Looking on the dev forum for answers.
- Publishing my game so that maybe the roblox game isn’t on the same version as the roblox studio game.
- Revamping the entire script, since its a very old one.
script in question
local TweenService = game:GetService("TweenService")
local Triggered = script.Parent.Triggered
local hinge1 = script.Parent:WaitForChild("Door1"):WaitForChild("Model"):WaitForChild("Hinge")
local hinge2 = script.Parent:WaitForChild("Door2"):WaitForChild("Model"):WaitForChild("Hinge")
local Prompt01 = script.Parent:WaitForChild("Door1"):WaitForChild("Model"):WaitForChild("DoorHandle1"):WaitForChild("ProximityPrompt")
local Prompt02 = script.Parent:WaitForChild("Door1"):WaitForChild("Model"):WaitForChild("DoorHandle2"):WaitForChild("ProximityPrompt")
local Prompt1 = script.Parent:WaitForChild("Door2"):WaitForChild("Model"):WaitForChild("DoorHandle1"):WaitForChild("ProximityPrompt")
local Prompt2 = script.Parent:WaitForChild("Door2"):WaitForChild("Model"):WaitForChild("DoorHandle2"):WaitForChild("ProximityPrompt")
local SFXOpen1 = script.Parent:WaitForChild("Door1"):WaitForChild("Model"):WaitForChild("Door"):WaitForChild("Open")
local SFXClose1 = script.Parent:WaitForChild("Door1"):WaitForChild("Model"):WaitForChild("Door"):WaitForChild("Close")
local SFXOpen2 = script.Parent:WaitForChild("Door2"):WaitForChild("Model"):WaitForChild("Door"):WaitForChild("Open")
local SFXClose2 = script.Parent:WaitForChild("Door2"):WaitForChild("Model"):WaitForChild("Door"):WaitForChild("Close")
local goalOpen1 = {}
goalOpen1.CFrame = hinge1.CFrame * CFrame.Angles(0, math.rad(-75), 0)
local goalOpen2 = {}
goalOpen2.CFrame = hinge2.CFrame * CFrame.Angles(0, math.rad(75), 0)
local goalClose1 = {}
goalClose1.CFrame = hinge1.CFrame * CFrame.Angles(0, 0, 0)
local goalClose2 = {}
goalClose2.CFrame = hinge2.CFrame * CFrame.Angles(0, 0, 0)
local tweenInfo1 = TweenInfo.new(1.5)
local tweenOpen1 = TweenService:Create(hinge1, tweenInfo1, goalOpen1)
local tweenClose1 = TweenService:Create(hinge1, tweenInfo1, goalClose1)
local tweenInfo2 = TweenInfo.new(1.5)
local tweenOpen2 = TweenService:Create(hinge2, tweenInfo2, goalOpen2)
local tweenClose2 = TweenService:Create(hinge2, tweenInfo2, goalClose2)
Prompt01.Triggered:Connect(function()
if Triggered.Value == true then
tweenClose1:Play()
tweenClose2:Play()
Triggered.Value = false
Prompt01.ActionText = "Open"
Prompt02.ActionText = "Open"
Prompt1.ActionText = "Open"
Prompt2.ActionText = "Open"
SFXClose1:Play()
SFXClose2:Play()
else
Triggered.Value = true
tweenOpen1:Play()
tweenOpen2:Play()
Prompt01.ActionText = "Close"
Prompt02.ActionText = "Close"
Prompt1.ActionText = "Close"
Prompt2.ActionText = "Close"
SFXOpen1:Play()
SFXOpen2:Play()
end
end)
Prompt02.Triggered:Connect(function()
if Triggered.Value == true then
tweenClose1:Play()
tweenClose2:Play()
Triggered.Value = false
Prompt01.ActionText = "Open"
Prompt02.ActionText = "Open"
Prompt1.ActionText = "Open"
Prompt2.ActionText = "Open"
SFXClose1:Play()
SFXClose2:Play()
else
Triggered.Value = true
tweenOpen1:Play()
tweenOpen2:Play()
Prompt01.ActionText = "Close"
Prompt02.ActionText = "Close"
Prompt1.ActionText = "Close"
Prompt2.ActionText = "Close"
SFXOpen1:Play()
SFXOpen2:Play()
end
end)
Prompt1.Triggered:Connect(function()
if Triggered.Value == true then
tweenClose1:Play()
tweenClose2:Play()
Triggered.Value = false
Prompt01.ActionText = "Open"
Prompt02.ActionText = "Open"
Prompt1.ActionText = "Open"
Prompt2.ActionText = "Open"
SFXClose1:Play()
SFXClose2:Play()
else
Triggered.Value = true
tweenOpen1:Play()
tweenOpen2:Play()
Prompt01.ActionText = "Close"
Prompt02.ActionText = "Close"
Prompt1.ActionText = "Close"
Prompt2.ActionText = "Close"
SFXOpen1:Play()
SFXOpen2:Play()
end
end)
Prompt2.Triggered:Connect(function()
if Triggered.Value == true then
tweenClose1:Play()
tweenClose2:Play()
Triggered.Value = false
Prompt01.ActionText = "Open"
Prompt02.ActionText = "Open"
Prompt1.ActionText = "Open"
Prompt2.ActionText = "Open"
SFXClose1:Play()
SFXClose2:Play()
else
Triggered.Value = true
tweenOpen1:Play()
tweenOpen2:Play()
Prompt01.ActionText = "Close"
Prompt02.ActionText = "Close"
Prompt1.ActionText = "Close"
Prompt2.ActionText = "Close"
SFXOpen1:Play()
SFXOpen2:Play()
end
end)