How To Make a Follow Script

From Legacy Roblox Wiki
Jump to navigationJump to search

Introduction

This tutorial will show you how to make a part follow another part. It will be using RocketPropulsion.


How to Add RocketPropulsion

You need to be in Roblox Studio. Make sure you are, and follow these steps:

1. Open the Explorer panel, and double click Workspace.
2. From there, select your Part that you will be using.
2. Go to Insert, and Object.
3. In the window that opens up, find RocketPropulsion, and click OK.
4. You should now see RocketPropulsion within the part. Select this.
5. Alter the properties based on your preference.

The Scripting Involved

Scripting will allow you to have more control over the RocketPropulsion object.

If you are in Roblox Studio,

  1. In the Explorer, select Workspace.
  2. Go to Insert, then Object.
  3. In the following window, find Script and press OK.
  4. Find the script, and double click to open the script writer.
  5. Copy and paste the following into this script window:
local RP = Instance.new("RocketPropulsion")      --Inserts RocketPropulsion
RP.Parent = workspace.Part                       --Moves object to Part
RP.MaxSpeed = 45                                 --45 is the set speed
RP.Target = workspace.Target                     --What it will follow
RP:fire()                                        --Moves towards set target
wait(5)                                          --Waits 5 seconds
RP:abort()                                       --Stops the RocketPropulsion

Now, click the Close button to exit from the script window.

In order to run the script, click on the Play button. Save your place first!


See Also