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

How can I get a script to go into the humanoid of a player?

In my script, I was trying to get the humanoid of the player instead of game.Players.LocalPlayers.

--Script

--Varibles

local plr = game.Players.LocalPlayer
-- Functions 

script.Parent.MouseButton1Click:connect(function(hit) 
    plr.PlayerGui.NotifyGui.Enabled = true
    wait(.5)
end)

How do I get it to grab the Humanoid from the workspace?

UI Properties w/ UI Screen

UI Properties

UI Screen

2 comments

0

You should use local scripts when dealing with GUIs. You'll encounter errors if you don't, as MouseButton1Click (that's part of a GUI Element) won't work with a server script.

0

'LocalPlayer' won't work either. This property is only visible to LocalScripts.

1 answer

✓ Accepted answer

It's really simple to access the humanoid. You need to access the character, then you can access the humanoid from there.

local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid

game.Players.LocalPlayer.Character to access the character from workspace.

Also, for this to work, you MUST be using a LocalScript.

3 comments

0

I'm getting 'Character' nil value

0

Try adding "wait(1)" at the very beginning of the script.

0

Okay.

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