Wondering how to get the character from a server script so i can fire a remote event AFTER the character has loaded.
Here, I’ll show you:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Wait()
remoteEvent:Fire()
end)
CharacterAdded is a function of Players
, whether you use it in server, module, or local.
use this if you want to run the event once
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Wait()
RemoteEvent:FireClient(Player)
end)
use this if you want to run the event every time you respawn
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()
RemoteEvent:FireClient(Player)
end)
end)
EDIT: fixed code blocks
1 Like
One question i have thats sorta related is it it best to use :FireAllClients() in this script or :FireClient()?
Look at this:
1 Like