Forum > Scripts >

Need help - Scripting (basic)

Posts: 1

Threads: 1

Joined: May, 2020

Reputation: 0

Posted

How do I access everyones humanoid if they are set in the workspace. Found a way to make a kill all, I only need to this.

  • 0

PoopMaster

SoundInfinity

noticed

Posts: 120

Threads: 23

Joined: Jul, 2019

Reputation: 9

Replied

Well, it's simple, just loop through the workspace's children and check if they contain a humanoid.

 

Here is the script:

[code]

-- GetChildren() returns a list of workspace's members (or children)

for index, child in next, workspace:GetChildren() do

    -- Safely checks if the child has a Humanoid object within it.

    local Humanoid = child:FindFirstChildOfClass("Humanoid")

    -- If the Humanoid exists then, it's gonna print the child's name.

    if Humanoid then

        print(child.Name, "has a humanoid.")

    end

end

[/code]

  • 0

Proud creator of: WRD+

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )