Hello! I am making this Closet Script. So far it works great and is functional. How ever it is really clunky and even though I am using Tween service, it still looks like it is like stuttering. Any suggestions? Here is what it looks like:
robloxapp-20230426-2235364.wmv (771.0 KB)
Here is the code:
local partStartPos = game.Workspace.SlidingCloDoorBed.Open.Position
local promptUsed = false
local TweenService = game:GetService("TweenService")
local function movePartToNewPos()
local destination = Vector3.new(-216.8, 35.5, -130.9)
local tweenInfo = TweenInfo.new(
3, -- duration of the tween in seconds
Enum.EasingStyle.Quad, -- easing style of the tween
Enum.EasingDirection.Out, -- easing direction of the tween
0, -- number of times to repeat the tween (0 means don't repeat)
false, -- whether to reverse the tween when it repeats
0 -- delay before starting the tween in seconds
)
local tween = TweenService:Create(game.Workspace.SlidingCloDoorBed.Open, tweenInfo, {Position = destination})
tween:Play()
end
local function movePartToStartPos()
local tweenInfo = TweenInfo.new(
1, -- duration of the tween in seconds
Enum.EasingStyle.Quad, -- easing style of the tween
Enum.EasingDirection.Out, -- easing direction of the tween
0, -- number of times to repeat the tween (0 means don't repeat)
false, -- whether to reverse the tween when it repeats
0 -- delay before starting the tween in seconds
)
local tween = TweenService:Create(game.Workspace.SlidingCloDoorBed.Open, tweenInfo, {Position = partStartPos})
tween:Play()
end
game.Workspace.SlidingCloDoorBed.Interact.ProximityPrompt.Triggered:Connect(function()
if not promptUsed then
movePartToNewPos()
promptUsed = true
else
movePartToStartPos()
promptUsed = false
end
end)
Any ideas?