Faster Tweening with Door

  1. What do you want to achieve? I want to achieve faster tweening with my door

  2. What is the issue? Door opens/closes not fast enough, video is here

  3. What solutions have you tried so far? I have looked at easing styles, searched a million topics, but nothing is what I needed.

To make it clear how it has to be like, you can find a YouTube video here

My current code is this:

local TweenService = game:GetService("TweenService")

local opened = false

local door = workspace.DoorTesting
local doorRoot = door.PrimaryPart

local sound = door.Interactive.CupboardSound

local DoorSwingInfo = TweenInfo.new(1)

local DoorSwingTweenOpen = TweenService:Create(doorRoot, DoorSwingInfo, {
	CFrame = doorRoot.CFrame * CFrame.Angles(0, math.rad(-90), 0)
})

local DoorSwingTweenClose = TweenService:Create(doorRoot, DoorSwingInfo, {
	CFrame = doorRoot.CFrame * CFrame.Angles(0, math.rad(0), 0)
})

door.Interactive.ClickDetector.MouseClick:Connect(function()
	if opened == false then
		sound:Play()
		DoorSwingTweenOpen:Play()
		opened = true
	else
		sound:Play()
		DoorSwingTweenClose:Play()
		opened = false
	end
end)

Any help would be greatly appreciated!

1 Like

Is this the speed of the tweening?

image

1 Like

TweenInfo describes how long a tween should take, whether it should repeat, and the style of the tween itself. You can change the duration of the tween by changing the first argument. Right now your tween takes one second. If you want it to take half a second then you would use TweenInfo.new(0.5) and so forth.

2 Likes