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

How do I find a Humanoid in a server script for a tool?

Asked by 2 years ago

Basically, tool is getting a humanoid but instead is giving me "error: Humanoid is not a valid member of Player "Players.TheBuliderMC" - Server - AbilityServer:4"

local Humanoid = script.Parent.Parent.Parent.Humanoid

1 answer

Log in to vote
2
Answered by
1JBird1 64
2 years ago

The problem here is that you try and get the humanoid as soon as the tool is inside of the player and not in the character

What you want to do inside of your script is:

local Humanoid = nil
local tool = script.How_many_Parents_for_you_to_get_the_tool

tool.Equipped:Connect(function()
   humanoid = tool.Parent:WaitForChild("Humanoid")
end)

This should fix your problem :)

0
I should do that next time. Thanks! TheBuliderMC 84 — 2y
Ad

Answer this question