I basically want my R15 player to have particles on their hands for 1.6 seconds. Here is the script (you don't need to add comments, I have some scripting knowledge of variables, parents, etc)
plr = game.Players.LocalPlayer cooldown = 1 local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=1541393089" function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Z and cooldown >0 then -- particles appear on LeftHand and RightHand cooldown = 0 local playAnim = plr.Character.Humanoid:LoadAnimation(anim) playAnim:Play() plr.Character.Humanoid.WalkSpeed = 40 wait(1.6) --particles are gone here plr.Character.Humanoid.WalkSpeed = 16 wait(3) print("Explosion Dash") cooldown = 1 end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Please help me!
Okay, I see you didn't even try to even make the particle emmiters. Just so you know, this community doesn't give answers for free, you need to try and learn.
Now, I'll give a few tips before I answer your question.
- Use
:Connect
instead of:connect
, this last one is deprecated and its functionality might be deleted anytime.- Now with
cooldown
variable, I see you only use0
and1
as its value, so you might want to usetrue
andfalse
, won't make any difference but your script will look nicer, just an opinion.
Now, I assume your script is a LocalScript due to UserInputService, which can only be accessed by client (if you don't know what I mean, then LocalScripts)
Now, I also assume you got your particles ready, if you got your particles done already then place them in ReplicatedStorage, and use this script:
plr = game:GetService("Players").LocalPlayer cooldown = false local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=1541393089" local particles = game:GetService("ReplicatedStorage").Particle --THIS IS WHAT THE SCRIPT WILL REFER AS THE PARTICLES YOU'RE GOING TO USE, CHANGE THIS IF YOUR PARTICLE'S NAME OR PARENT IS DIFFERENT. function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Z and cooldown ~= false then local CloneP1, CloneP2 = particles:Clone(), particles:Clone() CloneP1.Parent = plr.Character.RightHand; CloneP1.Enabled = true CloneP2.Parent = plr.Character.LeftHand; CloneP2.Enabled = true cooldown = true local playAnim = plr.Character.Humanoid:LoadAnimation(anim) playAnim:Play() plr.Character.Humanoid.WalkSpeed = 40 wait(1.6) CloneP1:Destroy(); CloneP2:Destroy() plr.Character.Humanoid.WalkSpeed = 16 wait(3) print("Explosion Dash") cooldown = false end end game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
This script won't work with R6 unless you add some condicionals and stuff. Hope this helped!
NOTE: THIS IS NOT FE COMPATIBLE, for more information, see Experimental Mode and Remote Events and Functions