I Need help with one horrible bug with the engine NEVER firing “PlayerAdded” event on studio.
and never firing “CharacterAdded” On both live servers and studio.
i have tried everything to fix the bug and it just never fire this broke my entire game because roblox IS UNABLE to make an game engine that functions properly.
local function PlayerStartup(Player: Player)
Player.CharacterAdded:Connect(function(char: Model)
AddLoadouts(Player)
end)
AddLoadouts(Player)
end
for _,Player in Players:GetPlayers() do
PlayerStartup(Player)
end
Players.PlayerAdded:Connect(PlayerStartup)
(i didnt add the other function because on itselfs it works)
please help me i cant figure this out
Basically the script is supposed to give the player overhead tags and weapons upon spawning.
(theses tags are customized for every single players) what i mean is that they can set multiple groups with their role in the group as the tag.
this function itself (AddLoadouts) entirely works.
The rest nah it never works.
its an server script
Server Script located where?
Can you share the rest of the code? Or try running this
local Players = game.Players
local function PlayerStartup(Player: Player)
Player.CharacterAdded:Connect(function(char: Model)
print(Player)
end)
print(Player)
end
for _,Player in Players:GetPlayers() do
PlayerStartup(Player)
end
Players.PlayerAdded:Connect(PlayerStartup)
the event decided to fire after like 30 attemps and some peoples are glazing studio bc its good hell naw (how can i avoid doing the players loop stuff im forced to do it because playeradded never fires in studio)
this is particular to the single play mode in studio, it uses your computer as both the server and client at the same time, because of the sequence of initialization, the player and its character is already ‘added’ before the server side is initialized.
and so in this particular mode, your own PlayerAdded and the first CharacterAdded are not fired. (and roblox confirmed that cannot be fixed this without other major workover)
so the workaround is that we use a loop to call the PlayerAdded and CharacterAdded on all current players and characters at least once.