Ad
Log in to vote
0

Door hinge keeps rotating the wrong way?

Asked by 22 days ago

I have this door attached to a hinge with hingeconstraints. When I rotate it in server view, all is working fine. But when I tween the hinges orientation using a script, the hinge rotates the complete wrong way. Even when the tween doesn't change the orientation, it still rotates completely wrong. Here's a gif of the rotation.

Here's the code that tweens it.

local tweenservice = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(0.2,Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local a = script.Parent.Parent.Hinge
local tween = tweenservice:Create(a, tweeninfo, {Orientation = Vector3.new(0,0,0)})
local tween2 = tweenservice:Create(a, tweeninfo, {Orientation =Vector3.new(0,0,0)})
local opened = false
script.Parent.ClickDetector.MouseClick:Connect(function()
    if opened == false then
        opened = true
        tween:Play()
    end
    if opened == true then
        opened = false
        tween2:Play()
    end
end)

Answer this question