So, You might be wondering "Why are you trying to make something localsided on a serverscript?" Well the reason is values, I have to modify a value with a serverscript so everything else works.
Everything works as intended, But the script gets played three times simultaneously and I just want it to play once each time the player jumps.
Here's the script.
local Players = game:GetService("Players")
local LP = game.Players:GetPlayerFromCharacter(script.Parent)
local Stat = LP:FindFirstChild("Statistics")
local Stamina = Stat:FindFirstChild("Stamina")
local debounce = false
LP.Character.Humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
local Jumped = LP.Character.Humanoid.Jump
if Jumped == true then
if debounce == false then
warn(LP.Name)
debounce = true
if Stamina.Value <= 0 then
Stamina.Value = 0
else
Stamina.Value = Stamina.Value - 1
end
end
end
if Jumped == false then
if debounce == true then
debounce = false
end
end
end)
