Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How do I make a model move? ( Advance Help needed )

Asked by
14dark14 167
4 years ago

Ok, the title of this makes me sounds like a beginner, but that's not the case in this situation. I know that you can just change the CFrame of the part every 0.1 seconds or stuff like that. But what I need is something better, don't tell me to use Translateby or BodyMovers because I'm pretty sure that wouldn't work either.

Ok, so what I want to know is how they animated the train in JailBreak or the moving parts In Tower Of hell or any moving object In any other good game.

BodyForce would work great if only you could make the part anchored, but you can't. I need something That makes the part move smoothly, something that doesn't make the part look like its laggy on other devices, something you can step on and move along with.

if only BodyForce could be applied to anchored parts :(

Thank you for your time!

0
You can just use tweening, look into TweenService Nanomatics 1160 — 4y
0
Do any of these work? If so, accept one, so people don't keep answering. zandefear4 90 — 4y

3 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Lerping!

Before you watch this learn about CFrame, moving on.

Lerping is a easy way of moving blocks! But very smooth and persice

here is how to lerp a part

local Part = game.Workspace.Part -- the part you want to lerp
local Part2 = game.Workspace.Part2 -- the part you want to lerp it to

for i = 0,1,.01 do -- It will go from 0 to 1 by 0.1 at a time and we are setting it to I
wait() -- waits since it's a while loop
Part.CFrame = Part.CFrame:Lerp(Part2.CFrame, i) -- It will lerp the part to the other part by using the i variable from last

You can also do it without a part2

local Part = game.Workspace.Part -- the part you want to lerp
local Part2 = game.Workspace.Part2 -- the part you want to lerp it to

for i = 0,1,.01 do -- It will go from 0 to 1 by 0.1 at a time and we are setting it to I
wait() -- waits since it's a while loop
Part.CFrame = Part.CFrame:Lerp(CFrame.new(0, 50, 0) * CFrame.Angles(0,math.rad(45), 0), i) -- It will lerp the part to the other part by using the i variable from last

0
Thanks, worked great, but I still have this issue that when you stand on the part you move along with it. 14dark14 167 — 4y
0
Oh! I have scripted in a long time and i have also not figured that one out maxpax2009 340 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

There's a function called MoveTo, if you use vector3 with it, you can move it anywhere! You can loop it using while true do, or maybe repeat until. Explanation: https://developer.roblox.com/en-us/api-reference/function/Model/MoveTo

Code:

local Model = game.Workspace.Model -- Your model here
while true do-- If you want it to loop
wait(.1) 
    Model:MoveTo(Vector3.new(0, -0.1, 0)
end

Answer this question