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

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

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

✓ Accepted answer

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! :)

1 comment

0

It did! (I'm just pretty new to scripting

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

1 comment

0

sorry if this wasn't what you meant

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