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

How do i gain access to "Humanoid" when clicking a button?

-- Here's my script, "I'm using a "LocalScript".


-----------

local part = script.Parent


local cd = part.ClickDetector

cd.MouseClick:Connect(function(playerwhoclicked)
	playerwhoclicked.Character.Humanoid.WalkSpeed = 100
end)

9 comments

0

Please use codeblock.

0

Why would you change the walkspeed via a local script?

0

I've tried it on a normal script, but doesn't seem to work as well, i have no clue what "codeblock" is as well. I'm sorry, i'm just new to lua coding. And i'm trying to learn it at a fast pace with the right people.

0

well first of all, you don't have to get the player who clicked, since you are accessing it with a local script

0

you just have to get the local player by writing: Player = game.Players.LocalPlayer and then do Player.Character.Humanoid.WalkSpeed = 100

0

the "and then do" is not part of the script, just so you know

0

Wait, let me just write an answer

0

@ZO0PPY, Edit the answer, click the lua button, and copy and paste your code inside it. I'm not gonna answer anything that doesn't have code block. That includes you, @KochbananemitGuave . I'm getting tired of newbies not using code block.

0

Inside a comment??

1 answer

LocalScripts don't run in the Workspace, making it a Script should work without any errors.

Hope this helped

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