Nabilekes
(Nabi)
February 27, 2024, 8:27pm
#1
Hi,
So I made a single door, and it opened using the Tween service, but now I’m trying to make it a double door with each one their own hinge and weld, but for some reason, they don’t open.
Could someone help me understand what the issue is? I appreciate any help, thanks!
You can find my script and others below:
(as you can see each hinge as their own weld with their own door)
(I put the prompt in the top frame of the doorframe. I didn’t know where else to move it for now)
(This is my script )
local TweenService = game:GetService("TweenService")
local hingeleft = script.Parent.LeftHinge
local hingeright = script.Parent.RightHinge
local prompt = script.Parent.Top.ProximityPrompt
local Open = {}
Open.CFrame = hingeleft.CFrame * CFrame.Angles(0, math.rad(90), 0)
Open.CFrame = hingeright.CFrame * CFrame.Angles(0, math.rad(90), 0)
local CLose = {}
CLose.CFrame = hingeleft.CFrame * CFrame.Angles(0, 0, 0)
CLose.CFrame = hingeright.CFrame * CFrame.Angles(0, 0, 0)
local tweenInfo = TweenInfo.new(1)
local tweenOpen = TweenService:Create(hingeleft, tweenInfo, Open)
local tweenOpen = TweenService:Create(hingeright, tweenInfo, Open)
local tweenClose = TweenService:Create(hingeleft, tweenInfo, CLose)
local tweenClose = TweenService:Create(hingeright, tweenInfo, CLose)
prompt.Triggered:Connect(function()
if prompt.ActionText == "Close" then
tweenClose:Play()
prompt.ActionText = "Open"
else
tweenOpen:Play()
prompt.ActionText = "Close"
end
end)
2 Likes
Scottifly
(Scottifly)
February 27, 2024, 8:31pm
#2
You’ve set tweenOpen and tweenClose twice each but you are calling just the one.
You need to set the names to something different, something like tweenOpenR and tweenOpenL and then call both tweenOpenR as well as tweenOpenL (and the same for close).
2 Likes
Nabilekes
(Nabi)
February 27, 2024, 10:01pm
#3
Hey!
I̶ a̶d̶j̶u̶s̶t̶e̶d̶ t̶h̶e̶ c̶o̶d̶e̶ l̶i̶k̶e̶ y̶o̶u̶ s̶a̶i̶d̶, b̶u̶t̶ t̶h̶e̶r̶e̶’s̶ a̶ w̶e̶i̶r̶d̶ i̶s̶s̶u̶e̶ h̶a̶p̶p̶e̶n̶i̶n̶g̶. Y̶o̶u̶ c̶a̶n̶ c̶h̶e̶c̶k̶ o̶u̶t̶ t̶h̶e̶ v̶i̶d̶e̶o̶ o̶f̶ h̶o̶w̶ t̶h̶e̶ d̶o̶o̶r̶ a̶c̶t̶s̶ +̶ t̶h̶e̶ u̶p̶d̶a̶t̶e̶d̶ c̶o̶d̶e̶. I̶’m̶ n̶o̶t̶ t̶o̶o̶ s̶u̶r̶e̶ w̶h̶a̶t̶’s̶ c̶a̶u̶s̶i̶n̶g̶ t̶h̶i̶s̶ t̶o̶ h̶a̶p̶p̶e̶n̶?̶
I had to fix the direction and hinges, but it did with the advice you gave. Thanks!
local TweenService = game:GetService("TweenService")
local hingeleft = script.Parent.LeftHinge
local hingeright = script.Parent.RightHinge
local prompt = script.Parent.Top.ProximityPrompt
local Open = {}
Open.CFrame = hingeleft.CFrame * CFrame.Angles(0, math.rad(90), 0)
Open.CFrame = hingeright.CFrame * CFrame.Angles(0, math.rad(90), 0)
local Close = {}
Close.CFrame = hingeleft.CFrame * CFrame.Angles(0, 0, 0)
Close.CFrame = hingeright.CFrame * CFrame.Angles(0, 0, 0)
local tweenInfo = TweenInfo.new(1)
local tweenOpenL = TweenService:Create(hingeleft, tweenInfo, Open)
local tweenOpenR = TweenService:Create(hingeright, tweenInfo, Open)
local tweenCloseL = TweenService:Create(hingeleft, tweenInfo, Close)
local tweenCloseR = TweenService:Create(hingeright, tweenInfo, Close)
prompt.Triggered:Connect(function()
if prompt.ActionText == "Close" then
tweenCloseL:Play()
tweenCloseR:Play()
prompt.ActionText = "Open"
else
tweenOpenL:Play()
tweenOpenR:Play()
prompt.ActionText = "Close"
end
end)
2 Likes
system
(system)
Closed
March 12, 2024, 10:02pm
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.