When I open my door it does a 360 turn and then opens/closes.
It’s obviously not supposed to open like that.
Code:
local open = false
local Hinge = script.Parent.Parent.Hinge
local CLoseGoal = {Orientation = script.Parent.Parent.Parent.HingeClose.Orientation}
local OPenGoal = {Orientation = script.Parent.Parent.Parent.HingeOpen.Orientation}
local Tweenservice = game:GetService("TweenService")
local info = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0,
false,
0
)
local Close = Tweenservice:Create(Hinge, info, CLoseGoal)
local Open = Tweenservice:Create(Hinge, info, OPenGoal)
script.Parent.ProximityPrompt.Triggered:Connect(function(hit)
if script.Parent.Parent.Locked.Value == false then
if open == true then
open = false
Close:Play()
script.Parent.SFX:Play()
else
open = true
Open:Play()
script.Parent.SFX:Play()
end
end
end)
try this. I think you have some error in the logic if, else part:
script.Parent.ProximityPrompt.Triggered:Connect(function(hit)
if script.Parent.Parent.Locked.Value == false then
if open == true then
open = false
Close:Play()
script.Parent.SFX:Play()
wait(5) --your cooldown in seconds
open = true
else return end
end
end
The door seems to do what a door does correctly on 2 axis??? This is not supposed to be happening. I tried to upload video but it decided it was time to give me an error
script.Parent.ProximityPrompt.Triggered:Connect(function(hit)
if script.Parent.Parent.Locked.Value == false then
if open == true then return end
elseif open == false then --door isn't opened
open = true
Close:Play()
script.Parent.SFX:Play()
wait(5) --your cooldown in seconds
open = false
end
end