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

How do you make a CFrame rotation slower for your door?

So I've made a door CFrame rotation, but I can't get it to open slower. I knew that using the Enum.EasingStyle wouldn't help but I tried it anyways. I've also tried using simple wait commands, but either I'm not putting them in the right place or it doesn't work. Here is my code:

local tween = game:GetService("TweenService")

local center = script.Parent.Center
local door = "closed"

local CF = Instance.new("CFrameValue")
CF.Value = center.CFrame

CF.Changed:Connect(function()
	center.CFrame = CF.Value
end)

local debounce = false
script.Parent.Door.ClickDetector.MouseClick:Connect(function()
	if debounce == true then return end
	debounce = true
	if door == "closed" then
		--Open door
		tween:Create(CF, TweenInfo.new(1, Enum.EasingStyle.Quad), {Value = center.CFrame * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))}):play()
		door = "open"
	else
		--Close door
		tween:Create(CF, TweenInfo.new(1), {Value = center.CFrame * CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))}):play()
		door = "closed"
	end
	wait(1)
	debounce = false
end)

1 answer

✓ Accepted answer

Very simply, the first parameter you put inside of TweenInfo.new() which is in your case `1``, is the value that indicates how long it would take the tween to finish its tweening.

TweenInfo.new(5, Enum.EasingStyle.Quad) --for example, I made it do the tween for 5 seconds

1 comment

0

Wow, I can't believe I didn't think of that, my mind fails me sometimes lol. Thanks!

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