I want to have a script that, when a player joins, will increase their jumpheight by 1, every 10s in the game. I know it can use tick or wait, but how?
Correct me if I'm wrong but I believe the client has control over their character including WalkSpeed, JumpPower, Velocity, etc...
01 | local player = game.Players.LocalPlayer |
02 | while true do |
03 | local char = player.Character or player.CharacterAdded:Wait() |
04 | if char then |
05 | local humanoid = char:FindFirstChild( "Humanoid" ) |
06 | if humanoid then |
07 | humanoid.JumpPower = humanoid.JumpPower + 1 |
08 | end |
09 | end |
10 | wait( 10 ) |
11 | end |
Essentially we have created a loop that will run forever and will add 1 to their current jump power every 10 seconds I don't know why someone would want to do this exactly.
If the client doesn't have control over jump power you can essentially do the same thing on the server using remote events etc... Good luck!
01 | local Player = game.Players.LocalPlayer |
02 |
03 | spawn( function () |
04 | while wait( 10 ) do |
05 | if Player.Character then |
06 | local Humanoid = Player.Character:WaitForChild( 'Humanoid' ) |
07 | Humanoid.JumpPower = Humanoid.JumpPower + 1 |
08 | end |
09 | end |
10 | end ) |
i highly reccommend NOT doing this on a client, as a hacker/exploiter could easily change how high you can jump which is cheating. you should do it on the server instead
01 | spawn( function () |
02 | script.Name = "SV_JumpPower_Script" |
03 | for _,player in ipairs (game.Players:GetPlayers()) do |
04 | coroutine.resume(coroutine.create( function () -- Do this so it dosent stop at the first player |
05 | while wait( 10 ) do |
06 | local Character = player.Character |
07 | local Humanoid = Character:FindFirstChildOfClass( "Humanoid" ) |
08 | if Character and Humanoid then |
09 | Humanoid.JumpPower = Humanoid.JumpPower + 1 |
10 | end |
11 | end |
12 | end )) |
13 | end |
14 | end ) |