0

# How to make a Stun Skill with P to activate and keep looping it unless i press P again?

Edited 1 year ago

guys, im making a stun skill what if i press P if get active and keep looking for ppl what get close to me for stun them, and if i press P again it stop look for ppl, but its not working, can you guys see my script pls?

game.ReplicatedStorage.StunThingP.OnServerEvent:Connect(function(player)
local UIS = game:GetService("UserInputService")
local looping = false

UIS.InputBegan:Connect(function(inp)
if inp.KeyCode == Enum.KeyCode.P then
if looping == false then
looping = true
while looping == true do
for _, v in pairs(game.Players:GetPlayers()) do
print("stun hmmmm!")
if v.Character ~= player.Character then
v.Character.Humanoid.WalkSpeed = 1
v.Character.Humanoid.JumpPower = 0
v.Character.Humanoid.WalkSpeed = 16
v.Character.Humanoid.JumpPower = 50
end
end
end

end
if inp.KeyCode == Enum.KeyCode.P then
looping = false
end
end
end
end)
end)

0
im using a LocalScript to detect when i press P and activating a RemoteEvent, should i use this or i can make this skill in just a single script? i want make it "giveable", for i give it just for me. Ariirael 15 — 1y
0
What is the problem? Is it not starting at all? Is it not stopping? Is it not looping? I can't exactly help if I don't know the specifics of the problem. A_thruZ 29 — 1y
0
its not starting when i tried to made that loop function, then.. isnt looping too. Ariirael 15 — 1y