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

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

Asked by
TheePBHST 154
7 years ago
Edited 7 years ago

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

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. AstrealDev 728 — 7y
0
'LocalPlayer' won't work either. This property is only visible to LocalScripts. Link150 1355 — 7y

1 answer

Log in to vote
0
Answered by
Mayk728 855 Moderation Voter
7 years ago
Edited 7 years ago

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.

0
I'm getting 'Character' nil value TheePBHST 154 — 7y
0
Try adding "wait(1)" at the very beginning of the script. Mayk728 855 — 7y
0
Okay. TheePBHST 154 — 7y
Ad

Answer this question