Tweened Door Rotating the Wrong Way

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)

Hinge Close Rotation:
0, 180, 0

Hinge Open Rotation:
0, -90, 0

Locations:
image

Kepp in mind, i’ve never had this problem before.

2 Likes

i need help my door look so stupid and ugly

1 Like

I made the door into a hinge door using physics, but if anybody knows a fix for tween door please help

1 Like

i need the door to tween though because my game is a horror game and the door has a lock

I’m not too sure if this helps, but try reversing the tween to see if it works. (not too experienced with TweenService, just trying to help)

If you’re just wanting to open and close the door, the close orientation goal should be the negation of the open orientation goal.

This happens tohugh

my recording glitched, btu what happened is it would never go into the center

Change the open orientation to 90 degrees and the close orientation to -90 degrees.

Thats what it was on in the vid

Does your door start out being opened or closed? If the orientation angle is set to 90 degrees there’s no reason it should be turning 180 degrees.

1 Like

It starts out closed, then when click = open , then close again (when it goes 180 .)

What are your orientations set to?

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

What weird is this:

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

actually, i’d totally rewrite it:

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

you might have to check the amount of 'end’s

No, that wont work because then it can’t open

its a problem with the orientation, not the script

they are
close:
0, -0, 0
open:
0, 90, 0

1 Like

what is the orientation of the actual door part