-
What do you want to achieve?
I would like to be able to script a chariot to follow a custom path. (Sort of like the cars in the earth realm on royale high)
-
What is the issue?
I don’t know how to do that.
-
What solutions have you tried so far?
I’ve tried tweening the model’s position and orientation using the position and orientation of parts laid out on the path I would like the chariot to follow but this solution seems a bit clunky.
(attached video for reference) The main issues are that 1. Tweening a welded model is turning out to be a bit glitchy and 2. I don’t think this solution will be well suited to terrain that has a gradient.
I’ve been looking on the dev forum for people working on similar models and I’ve seen raycasting and bezier curves being suggested however, I am having a hard time grasping how to use them despite reading their developer articles.
Thank you for reading! Any help is truly appreciated. Also first time post on the forum wooo!!!
2 Likes
Hi Valerie!
I have been working on something similar to what you are asking about, and Tweening models can be really choppy, but I found a fix using MoveTos.
Now I admit that this is probably not the best solution, and it’s probably really overcomplicated, but if it works, it works
What I did was I welded a Roblox R15 Dummy to the car and made him invisible and remove the face decal so you can’t see him. That way we can use MoveTo() because he has a Humanoid. Then I layed out a path of parts for the car to move to. I put these parts in a folder called waypoints, labeled them 1 - 10 (How many waypoints I had), and used this script inside the dummy to move the car to each one of them:
local Dummy = script.Parent
local Waypoints = game.Workspace.Waypoints -- The folder of our parts --
wait(5) -- Wait for the game to load. --
for i, v in pairs(Waypoints:GetChildren()) do -- For each part in the Waypoints Folder --
Dummy.Humanoid:MoveTo(v.Position) --Move the dummy to the waypoint's position--
Dummy.Humanoid.MoveToFinished:Wait() -- wait after it is done moving to the part to prevent lag --
end
Sorry if this is confusing, but this is the way I used, and I am not too advanced in the scripting field. Hope this helps
2 Likes
Thank you ever so! This seems pretty feasible! Will try it out asap
1 Like