I want to make a script that makes a player's jump power or walk speed higher, but each player have a different name. I'm having difficulties to knowing the players name. Can someone make me a script and care to explain what each line means? I tried using this:
1 | local JButton = game.Workspace.JButton |
2 |
3 | JButton.ClickDetector.MouseClick:Connect( function (plr) |
4 | game.Workspace.plr.Humanoid.JumpPower = 100 |
5 | end ) |
P.S I am still pretty new to scripting
try this
1 | local JButton = game.Workspace.JButton |
2 | JButton.ClickDetector.MouseClick:Connect( function (plr) |
3 | -- game.Workspace.plr.Humanoid.JumpPower = 100 -- Old code |
4 | workspace [ plr.Name ] .Humanoid.JumpPower = 100 -- New code |
5 | end ) |
because you're getting the player's name index of Workspace. May I also point out you to use workspace
instead of game.Workspace
, as it is static and saves time.