So I'm trying to put particles effect in a player after pressing the later "F" however, I tried all the scripts that might work but it didn't... can anyone please help?
How would I put particle effects on a player when a player presseda keyboard button?
1 answer
So, First You Need To Insert A local script in StarterPlayer.StarterCharacterScripts then we have to know what U.I.S Is ..So U.I.S Basically Stands For UserInputService, Its Name Is Really Self Explanatory It Detects If A Player Has Pressed A certain Button(Input) so we'd have to first Get The Player Then detect if the player is Pressing Something But First Lets Get The UIS Service:
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
After We Got The Service It Should Be Easier To Detect What The Local Player Has Pressed Since We Dont Need To Write A Whole Line But Instead "uis" Because Thats What We Refrenced It To, So Now We Detect If A Player Has Pressed A KB Button :
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
end)
This Will Only Detect If A Player Presses ANY Button Which Is Not What We Want So.. We'll Have to detect WHICH button Has Been Pressed:
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
print("ButtonF Has Been Pressed")
end
end)
This Should Print "ButtonF Has Been Pressed" Since The Player Pressed "F" Now After That We Can Tell The Script Finally What To Do When "F" is Pressed, Which In Your Case You Want It To Add A Particle Effect So We Will Use "Instance.new" Which Adds An Instance:
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
print("ButtonF Has Been Pressed")
local Effect = Instance.new("Fire") --replace this with the particle you want/effect
end
end)
Then Will Set The Parent To The Local Players Character:
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.F then
print("ButtonF Has Been Pressed")
local Effect = Instance.new("Fire") --replace this with the particle you want/effect
Effect.Parent = player.Character.Head
end
end)
This Should Be Working Properly You Can Just Change The Particele To Whatever You Want, it would like this : https://gyazo.com/ebec1261b579dd78281065aab5215838, Edit: Accept This As An Answer If It Worked.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Don't forget your gameProcessedEvent
Hmm.. Yup I Forgot But It Still Worked.