How to Make a Trail in Roblox Studio
- first thing you’re going to want to do is you’re going to go into replicatedstorage right over here and you’re going to hit plus
- then you’re going to search for trail click on it and click on our trail and go into the properties window and you’re going to click on color right here
- once you click on it there’s going to be three dots next to it. click on those three dots this is how you get the rainbow effect if you don’t want to get a rainbow effect you can skip this part, but if you do then what we’re going to do is we’re just going to evenly space out a couple of these and then we’re going to click each one and make it a different color so we’re actually going to start with this first one over here we’re going to make it red and we’re just going to go through the colors of the rainbow here
- so i’m doing orange yellow. so as you can see now i’ve made my little color trail i’m going to hit close
- i’m going to scroll down i’m going to find emission i’m just going to change the lifetime of 3 i just like a little bit of a longer trail you can mess around with these settings if you would like
- then you’re going to serverscriptservice and you’re going to add a script i’ve already done so but in case you don’t know this little plus sign here you click script right there it does it perfect
- so now that we’re in the script delete this and we’re going to type it out first we are going to get we’re going to get the players player added function and we’re going to connect a new function with a parameter of a player and then whenever that player’s character joins
- so this is going to be whenever a player joins the game and then the first time or actually whenever their character is added after they die or when they’re first spawning in or ift hey’re teleporting things like that
- we’re going to attach another function of that with the parameter of char which is your sort for character and then we’re going to start with our trail code so first we’re going to get a reference to the trail and that’s going to be game dotreplicated storagedot trail and we’re going to clone it because we don’t want to simply just grab it because then there’s only going to be one and if you have multiple players that’s going to be a problem
- we’re going to set the trails parent to the head of our character so it’s going to be coming out of their head if you want to now have it come out of a different bodypart then you can change that and then we’re going to get attachments here
- attachments are how the trail knows where to go from so in this case it’s going to be the head and the humanoid root part so new instanceof an attachment comma and that’s just going to be the char head and another local attachment
- we can just copy this code and paste it change zero to one here instead of the char dot head we’re going to do char dot humanoid root part
- next we’re going to actually attach these attachments to our trail so our trail knows what it’s attached to so we’re gonna do attachment zero equals attach zero and
- again you can just copy this code paste it and change both of these zeros to ones
- then once you’ve done that you can exit out that script and hit play. Once we get in game you will see that we have our magnificent little trail here