So I want this script to make it so each time you jump it adds to a leaderboard. I added something where if you have 50 jumps on the leaderboard it will show a gui. It works but when that does that it stops counting how many jumps on the leaderboard please help me fix this. Here is the code:
local plr = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") local debounce = false local debounce2 = false local Jumps = game.Players.LocalPlayer.leaderstats local JumpCounter = script.Parent.Parent.Jumps local Sound = script.Parent.Parent.Sound plr.Jumping:Connect(function() if not debounce then debounce = true Jumps.Jumps.Value = Jumps.Jumps.Value + 1 JumpCounter.Text = Jumps.Jumps.Value if(game.Players.LocalPlayer.leaderstats.Jumps.Value >= 50) then Sound:Play() wait(3) Sound:Destroy() script.Parent.Parent.Frame.Visible = true script.Parent.Parent.Frame.Trail1.Visible = true else script.Parent.Parent.Frame.Visible = false script.Parent.Parent.Frame.Trail1.Visible = false end debounce = not debounce end end)
Have you tried separating that over 50 jump clause? It could be that once it hits 50 jumps, the gui just keeps playing, rather than an increase in the jump value. Try this:
local plr = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") local debounce = false local debounce2 = false local Jumps = game.Players.LocalPlayer.leaderstats local JumpCounter = script.Parent.Parent.Jumps local Sound = script.Parent.Parent.Sound plr.Jumping:Connect(function() if not debounce then debounce = true Jumps.Jumps.Value = Jumps.Jumps.Value + 1 JumpCounter.Text = Jumps.Jumps.Value if(game.Players.LocalPlayer.leaderstats.Jumps.Value >= 50) then Sound:Play() wait(3) Sound:Destroy() script.Parent.Parent.Frame.Visible = true script.Parent.Parent.Frame.Trail1.Visible = true else script.Parent.Parent.Frame.Visible = false script.Parent.Parent.Frame.Trail1.Visible = false end debounce = not debounce end end) if(game.Players.LocalPlayer.leaderstats.Jumps.Value >= 50) then if debounce2 == false then debounce = true Sound:Play() wait(3) Sound:Destroy() script.Parent.Parent.Frame.Visible = true script.Parent.Parent.Frame.Trail1.Visible = true debounce2 = false else script.Parent.Parent.Frame.Visible = false script.Parent.Parent.Frame.Trail1.Visible = false end