Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Changing the Humanoid by pressing a button?

Asked by 6 years ago

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:

local JButton = game.Workspace.JButton

JButton.ClickDetector.MouseClick:Connect(function(plr)
    game.Workspace.plr.Humanoid.JumpPower = 100
end)

P.S I am still pretty new to scripting

1 answer

Log in to vote
0
Answered by 6 years ago

try this

local JButton = game.Workspace.JButton
JButton.ClickDetector.MouseClick:Connect(function(plr)
    -- game.Workspace.plr.Humanoid.JumpPower = 100 -- Old code
    workspace[plr.Name].Humanoid.JumpPower = 100 -- New code
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.

0
oh wow it works, thanks a lot man! SirDerpyHerp 262 — 6y
0
@SirDerpyHerp please click "Accept Answer" SebbyTheGODKid 198 — 6y
Ad

Answer this question