Help me please i want to create a simulator
01 | while wait(. 5 ) do |
02 | local children = game.Players:GetChildren() |
03 | for i = 1 , #children do |
04 | if children [ i ] .Character ~ = nil then |
05 | local hum = children [ i ] .Character.Humanoid |
06 | hum.JumpPower = children [ i ] .leaderstats.Jump.Value/ 3.12 |
07 | if game.Players.LocalPlayer.Character.Humanoid.Jump = = true then |
08 | game.Players.LocalPlayer.leaderstats.Jump.Value = game.Players.LocalPlayer.leaderstats.Jump.Value + 1 |
09 | end |
10 | end |
11 | end |
12 | end |
Don't use loop. Just detect when the player is jumping by using :GetPropertyChangedSignal()
use Players.PlayerAdded
to get player and use Player.CharacterAdded
to get player's character
01 | game.Players.PlayerAdded:Connect( function (plr) |
02 | plr.CharacterAdded:Connect( function (char) |
03 | local hum = char.Humanoid |
04 | hum:GetPropertyChangedSignal( "Jump" ):Connect( function () |
05 | if hum.Jump = = true then |
06 | plr.leaderstats.Jump.Value = plr.leaderstats.Jump.Value + 1 |
07 | hum.JumpPower = plr.leaderstats.Jump.Value/ 3.12 |
08 | end |
09 | end ) |
10 | end ) |
11 | end ) |
Also change the script from LocalScript to ServerScript