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

i expect my name in the output but nothing happens?

just a simple script that wont seem to work

local Players = game:GetService("Players") local function onCharacterAdded(character) local player = Players:GetPlayerFromCharacter(character) print(player.DisplayName) end

we all know this is supposed to print your name in the console but instead it does nothing no errors no prints so im kinda at a stand still here

1 answer

✓ Accepted answer

its a function you have to call it after and if your trying to call it whyen character is added you have to do this

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		onCharacterAdded(char)
	end)
end)

3 comments

0

im not very big brain

0

local Players = game:GetService("Players") local function onCharacterAdded(character) local player = Players:GetPlayerFromCharacter(character) print(player) end local function onPlayerAdded(player) player.CharacterAdded:Connect(onCharacterAdded) end Players.PlayerAdded:Connect(onPlayerAdded)

0

lol u gud its always the small things

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