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

Can't seem to find Humanoid?

This will select a random player but it doesn't seem to be finding a Humanoid. The purpose of the script is to force equip a tool to a random player and it's not working and I'm not too sure why?

local players = game.Players:GetChildren()
local randomplayer = players[math.random(1, #players)]
randomplayer:WaitForChild("Humanoid")
randomplayer.Humanoid:EquipTool(game.ServerStorage.HotPotato)

2 answers

✓ Accepted answer

The Humanoid object is inside of the Player's Character, not inside the Player(:

Look for the humanoid inside of the Player's Character!

local players = game.Players:GetChildren()
local randomplayer = players[math.random(1, #players)]

--Search in character
randomplayer.Character:WaitForChild("Humanoid")
randomplayer.Character.Humanoid:EquipTool(game.ServerStorage.HotPotato)

6 comments

0

Ohh, I should have known that haha, thank you! However, the tool isn't showing up in any players?

0

When a tool is equipped, it's in the Character. Look there.

0

The tool just isn't showing up anywhere... It's called HotPotato and it's parented under ServerStorage, I just pasted in the code you gave me and it's not showing up anywhere and there's no output.

0

If you just Parent the tool into the character it works too

0

Hm.. For some reason I'm having some extensive trouble. Can I just accept this as an answer and PM you on Roblox?

0

Yeah

The humanoid is inside the player's 3d model in Workspace, or it's Character.

cal players = game.Players:GetChildren()
local randomplayer = players[math.random(1, #players)]
randomplayer.Character:WaitForChild("Humanoid")
randomplayer.Character.Humanoid:EquipTool(game.ServerStorage.HotPotato)

Hope this helped!

4 comments

0

This one worked for me, but how do I make it stay equipped no matter what the player does?

0

You could turn it into a while wait() loop after line 2.

0

I've already tried that and they're still able to unequip :( No output

0

OH.......Just look into the tool properties. I think it's called 'Droppable' or something.

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