Im trying to make a sprint script and when you sprint it has a wind particle effect. i tried to weld particles to the player but that didnt work and i tried to insert particles into the arms and stuff but no results. I would like to find out how to do this!
The answer above was correct but, he did not show examples. So I will be teaching you step by step. Follow the steps below:
- Make sure you have the Particle in
ReplicatedStorage
- Make sure that you have a
**BoolValue**
that will bet set to true when the player is sprinting.
If you don't have 2 done then write this simple code and place it in ServerScriptService
game.Players.PlayerAdded:Connect(function(plr) -- fires when a player joins and creates a var plr local Status = Instance.new('Folder') -- create a folder Status.Name = "Status" -- changes the name of the new folder to status Status.Parent = plr -- the parent of this folder is plr local Sprinting = Instance.new('BoolValue') -- the boolvalue Sprinting.Name = "Sprinting" -- Changes name Sprinting.Value = false -- the player is not sprinting so false Sprinting.Parent = Status -- this will be sent to the folder status end)
Notes from this script:
- When doing something like :connect(function() use connect with a cap C. so it would look like :Connect instead of :connect
- If this script doesn't function, then add a wait(0.5) on the top line of Status
- Do not place ServerScripts (normal scripts) inside of
Workspace
. There's a reason**ServerScriptService**
Exists.
Now continuing;
- Make sure you have some way to sprint; e.x.g: Holding Shift, Clicking a button etc.
- add these line to your code;
local Sprinting = game.Players.LocalPlayer:WaitForChild("Status").Sprinting -- teh variable local Particles = game.ReplicatedStorage:WaitForChild("PartilceName") -- something:Connect(function() Sprinting.Value = true -- changes sprinting to true -- you code that adds speed and everything local CP = Particles:Clone() CP.Parent = -- playerrs torso (add it your self) if Sprinting = false then CP:Destroy() end end)
Notes: 1. You have to add the place where the particles go 2. I wrote everything from scratch, fix any mistakes. 3. you have to detect if the player's sprinting or not and set sprinting to false when the player stops 4. If you followed everything then this should work.
Good Luck And Have Fun Developing!
You don't really need to weld anything, heres how I would do it, I would put a particles instance inside the torso of the character and then when they are sprinting I would enable it. theres not much to it.