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

Is there any way to get a character from a given player?

Asked by 6 years ago

I don't exactly know what to try, that's the issue I'm having, and I can't think of a way to do it.(unless you count characteradded but i dont think that would work)

2 answers

Log in to vote
0
Answered by
chomboghai 2044 Moderation Voter Community Moderator
6 years ago

Yes. Simply use the Character property of player. CharacterAdded is also useful if it's possible that the character hasn't loaded yet.

local character = player.Character or player.CharacterAdded:Wait()
-- will wait until character spawns to get character

Hope this helps! :)

0
It did! (I'm just pretty new to scripting mlgwinners 30 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Yes, If you want to get the character of a player that just joined, like to make a leaderboard, use this script (if it's a leaderboard put the script in ServerScriptService)

game.Players.PlayerJoined:Connect(function(player)
    local ls = Instance.new("Folder", player) --This will create the leaderboard folder
    ls.Name = leaderstats --This will set the folder name to leaderstats

    local cn = "CurrencyName" --Put your currency name between the " "
    local m = Instance.new("IntValue", player.leaderstats) --This puts it in the leaderstats folder
    m.Name = cn --This will set the name of the currency to the name choosed above
0
sorry if this wasn't what you meant User#23793 0 — 6y

Answer this question