Basicaly I want this to count the number of times you jump. If you reached a certain amount of jumps I want it to do something. For some reason It only works on studio. Here is the code:
local plr = game.Players.LocalPlayer.Character 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.Humanoid.Changed:connect(function(prop) if prop == 'Jump' and not debounce then debounce = not debounce game.Players.LocalPlayer.leaderstats.Jumps.Value = game.Players.LocalPlayer.leaderstats.Jumps.Value + 1 JumpCounter.Text = game.Players.LocalPlayer.leaderstats.Jumps.Value if(game.Players.LocalPlayer.leaderstats.Jumps.Value >= 50) then Sound:Play() wait(3) Sound:Destroy() script.Parent.Parent.Trail1.Visible = true else script.Parent.Parent.Trail1.Visible = false end wait() debounce = not debounce end end)
You should be using Jumping() event.
local plr = game.Players.LocalPlayer.Character 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.Humand.Jumping:Connect(function() if not debouce then debounce = true Jumps .Jumps.Value = Jumps .Jumps.Value + 1 JumpCounter = Jumps .Jumps.Value if(game.Players.LocalPlayer.leaderstats.Jumps.Value >= 50) then Sound:Play() wait(3) Sound:Destroy() script.Parent.Parent.Trail1.Visible = true else script.Parent.Parent.Trail1.Visible = false end debounce = not debounce end end)