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

How to get the character and humanoid of a player using a server script?

Asked by 2 years ago

im stupid and i don't know how to do that, i also don't even know if it works soooo

If anyone knows, please answer, I'd appreciate it a lot

1 answer

Log in to vote
0
Answered by
aviel101 165
2 years ago
Edited 2 years ago

specific player

local Players = game:GetService("Players")

-- get specific player
local player = Players:FindFirstChild("InsertPlayerNameHere")

-- to get the character
local character = player.Character

-- to get the humanoid from character
local humanoid = character:WaitForChild("Humanoid")

every player that joined the game

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local humanoid = character:WaitForChild("Humanoid")
    end)
end)
0
I am stupid. Sorry for wasting your time like this, but what i meant was to get the character and Humanoid of any player using a server script, not just a specific one. Again sorry for not stating my question correctly and therefore wasting your time lolmarios2647 46 — 2y
0
you're not wasting my time don't worry, and you're not stupid. i added another script that gets the character and humanoid of any player in serverscript aviel101 165 — 2y
0
thank you so much you have saved me a lot of time lolmarios2647 46 — 2y
Ad

Answer this question