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

Door Tween Service Not Doing Anything?

script.Parent.Door.Handles.Knobs.Handle1.ClickDetector.MouseClick:Connect(function()
	if script.Parent.Open.Value == true then
		local TweenService = game:GetService("TweenService") --Gets the TweenService
		local TweenPart = script.Parent.Door.Hinge --Part that you wan to tween
	
		local TweenInformation = TweenInfo.new(
		
			1, -- Time/length
		
			Enum.EasingStyle.Quad, -- EasingStyle
		
			Enum.EasingDirection.Out, -- EasingDirection
		
			1, -- How many times tween will repeat, negative numbers if you want to loop it
		
			false, -- Reverse the Tween Session (Turn into the new given Properties, and go turn back into the normal part's properties. Boolvalue)(true or false)
		
			1 -- Delay between tweens(seconds).
		
		)
	
		local TweenGoals = {
		
			Orientation = Vector3.new(0,-90,0);
		
		}
	
		local TweenAnimation = TweenService:Create(TweenPart, TweenInformation, TweenGoals)
		TweenAnimation:Play()
	else
		local TweenService = game:GetService("TweenService") --Gets the TweenService
		local TweenPart = script.Parent.Door.Hinge --Part that you wan to tween
	
		local TweenInformation = TweenInfo.new(
		
			1, -- Time/length
		
			Enum.EasingStyle.Quad, -- EasingStyle
		
			Enum.EasingDirection.Out, -- EasingDirection
		
			1, -- How many times tween will repeat, negative numbers if you want to loop it
		
			false, -- Reverse the Tween Session (Turn into the new given Properties, and go turn back into the normal part's properties. Boolvalue)(true or false)
		
			1 -- Delay between tweens(seconds).
		
		)
	

		local TweenGoals = {
		
			Orientation = Vector3.new(0, 180, 0);
		
		}
	
		local TweenAnimation = TweenService:Create(TweenPart, TweenInformation, TweenGoals)
		TweenAnimation:Play()
	end
end)

Here Is A Script And Hinge Is A Primary part Of The Model So I Amused By Changing The Primary Part Rotation It Will Rotate The Door But Nothing Happens

1 comment

0

iirc I don't think you can set the orientation directly you might have to do it via CFrame

1 answer

To change the orientation, try:

CFrame = CFrame.new(a cframe) * CFrame.Angles(0, 0, 0)

We're using CFrame.Angles to change the orientation. Note that if the number is not 0, you must put it in math.rad(), example:

CFrame = CFrame.new(a cframe) * CFrame.Angles(0, math.rad(180), 0)

1 comment

0

I Have Used That But I Want To Smoothly Rotate It

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