Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Changing the Humanoid by pressing a button?

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

✓ Accepted answer

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.

2 comments

0

oh wow it works, thanks a lot man!

0

@SirDerpyHerp please click "Accept Answer"

This discussion is preserved as it was. New answers, comments, and votes are closed.