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

i expect my name in the output but nothing happens?

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
im not very big brain Pitched_mobile 191 — 4y
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) Pitched_mobile 191 — 4y
0
lol u gud its always the small things Vetrodex 22 — 4y
Ad

Answer this question