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

Is there anyway to change to orientation without actually rotating the door?

I made a door and a script to open and close it using TweenService but then I realized the door was made on the vector(0,0,0) but I need it to be (-90,0,0). Whenever I click to open the door, it goes back to its old vector. Is there any way I can change the orientation without actually rotating it or is there a code for it? If there is, please help me add it to the script:

local Door = script.Parent

local TweenService = game:GetService("TweenService")

local TweenStyle = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,0,false,0)

local DoorOpen = {CFrame = CFrame.new(139.771, 71.004, 13.057)}

local DoorClose = {CFrame = CFrame.new(139.771, 71.004, 17.057)}

local OpenTween = TweenService:Create(Door,TweenStyle,DoorOpen)

local CloseTween = TweenService:Create(Door,TweenStyle,DoorClose)

click = script.Parent.click

debounce = false

click.MouseClick:Connect(function()

if debounce == false then --open 
	debounce = true 

	OpenTween:Play() 

else 

	CloseTween:Play() --close 

	debounce = false

end

end)

Thank you so much.

1 answer

✓ Accepted answer

You have to Multiply it with CFrame.Angles to change orientation also use math.rad() as 1 already rotates it alot and not by 1 degree

local DoorOpen = {CFrame = CFrame.new(139.771, 71.004, 13.057)*CFrame.Angles(math.rad(-90),0,0)}

local DoorClose = {CFrame = CFrame.new(139.771, 71.004, 17.057)*CFrame.Angles(math.rad(-90),0,0)}

1 comment

1

Thank you, it works. <3

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