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

How to change the speed of how fast my part is going(CFrame)?

local RunService = game:GetService("RunService")
local part = game.workspace:WaitForChild("Start")
local part1 = game.workspace:WaitForChild("Finish")

local PART1_POS = part1.position
local PART_POS = part.position
local DURATION = 5


RunService.RenderStepped:Connect(function()
	local deg = 0*(wait(10) % DURATION)/ DURATION
	part.CFrame = CFrame.new(PART1_POS) * CFrame.Angles(0,0,(deg),0) * CFrame.new(PART_POS)
end)

That is what I have so far, but whenever i try it the part moves instantly, it does not move smoothly to the other part? How do you fix this?

1 answer

The best way to do this would be to use TweenService.

Essentially, use the TweenInfo.new function to declare the speed of the tween.

Use the TweenService:Create() method to create the tween.

And finally, use the Play function to play the tween.

local TweenService = game:GetService("TweenService")
local part = workspace:WaitForChild("Start")
local part1 = workspace:WaitForChild("Finish")
local tweenInfo = TweenInfo.new(5) --5 Seconds
local goal = {};
goal.CFrame = part1.CFrame; --Make the goal's CF part1's CF
 
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()

1 comment

1

well said Goulstem, Now Ima try the TweenService for the players torso

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