Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[Solved] Why does make part tween correctly at first then it starts doing 360s?

local t = game:GetService("TweenService")

local infoOpen = TweenInfo.new(2, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut, 0, false, 0)
local goalOpen = {}
goalOpen.Position = script.Parent.DoorRefOpen.Position
goalOpen.Orientation = Vector3.new(0, 90, 0)


local infoClose = TweenInfo.new(2, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut, 0, false, 0)
local goalClose = {}
goalClose.Position = script.Parent.DoorRefClose.Position
goalClose.Orientation = Vector3.new(0, 180, 0)

local g = false

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
	if g == false then
		local d = t:Create(script.Parent.DoorHandle, infoOpen, goalOpen)
		d:Play()
		g = true
	elseif g == true then
		local d = t:Create(script.Parent.DoorHandle, infoClose, goalClose)
		d:Play()
		g = false
	end
end)

1 answer

Solved it all I need to do was change line 6 to:

goalOpen.CFrame = script.Parent.DoorHandle.CFrame:ToWorldSpace(CFrame.Angles(0, math.rad(-90), 0))

This discussion is preserved as it was. New answers, comments, and votes are closed.