#How to RESET the ROTATION of a part?
1 messages · Page 1 of 1 (latest)
is this ur first time scripting😭
"==" is to compare not to set a value btw
and you cant just set rotation like that
I would save the old cframe in a variable and set the cframe to the variable
assuming ".PrimaryPart" is a hinge I would make this:
local TS = game:GetService("TweenService")
local OldFrame = Frame.PrimaryPart.CFrame
local OpenFrame = OldFrame * CFrame.Angles(0,math.rad(-90),0)
local DoorInfo = TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
local OpenTweeen = TS:Create(Frame.PrimaryPart, DoorInfo, {CFrame = OpenFrame})
local CloseTweeen = TS:Create(Frame.PrimaryPart, DoorInfo, {CFrame = OldFrame})
I typed this str8 into dc so idk if its workin
theres a toturial on youtube too
no its not
im like 1 year of this
i just did this == bcz i was running out of options
ahh I see
when ur so desperate you just try everthing lol
yeah man
watch a toturial like the 5 min one like first search result
You should save the CFrame of the door before anything so you can revert back to that:
local Door: Model = "path-to-door"
local DoorOriginCFrame: CFrame = Door.PrimaryPart.CFrame
local Tweenfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local TweenOpen = TweenService:Create(Door.PrimaryPart, Tweenfo, { CFrame = Door.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(90), 0) })
TweenOpen:Play()
task.wait(4)
local TweenClose = TweenService:Create(Door.PrimaryPart, Tweenfo, { CFrame = DoorOriginCFrame })
TweenClose:Play()
-- If you add your door model into the door variable, and it has a primarypart that works properly, this should work to properly open and close your door. (only visually)
-- I'm not sure if it will turn on the right axis or direction, since I'm just guessing. You can change the CFrame.Angles to change the rotation.