What do you want to achieve? CharacterAdded event working on first login.
What is the issue?
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
print("DEBUG 1")
Sometimes this DEBUG 1 prints, other times don’t! In character respawn it works fine. But the problem its in first login on a server!
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried some many orders. Tried to wait character and so on.
1 Like
Depends on what you want, if you want something to happen to the character when their player joins the game just do
local character = player.CharacterAdded:Wait()
-- then proceed to do the rest of the script
Hello, my problem here is pretty basic: the CharacterAdded event just doesn’t fire.
This is my script right here:
game:GetService("Players").PlayerAdded:Connect(function(plr)
--player stuff here
plr.CharacterAdded:Connect(function(char)
print("Character added.")
--character stuff here
end)
end)
This makes my game break, as in the character I put a lot of essential things, like stats, the player’s custom avatar, etc…
As you can see “Character a…
CharacterAdded doesn’t work when you first load in the game, so you have to do something like this.
game.Players.PlayerAdded:Connect(function(plr)
function charAdded(Char:Model)
print("spawned")
end
plr.CharacterAdded:Connect(charAdded)
repeat task.wait() until plr.Character
charAdded(plr.Character)
end)
1 Like
CharacterAdded does work when you first load the game. It’s just that in studio the character can* load before even the function happens.
1 Like
looks like this worked! Thanks man!
1 Like
system
(system)
Closed
December 28, 2022, 5:53am
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.