I need to simulate 2 players in Studio:
- Start the server with 2 players
- Remove Player 1
- Player 1 needs to enter the game again (without restarting the server)
How to do that?
I need to simulate 2 players in Studio:
How to do that?
Change it to 1 player
and press Start again. It’ll keep the existing server and just add a new player. I can’t guarantee it’ll use the same UserId
Would it not be possible for Player removal and joining events to have their functions decoupled (no longer anonymous) from the associated events.
This’ll allow you to “simulate” a Player being added or removed from a separate hook, without having to removing them.
Have you tested before?
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
print(Player.UserId)
end)
Players.PlayerRemoving:Connect(function(Player)
print(Player.UserId)
end)
I don’t quite understand, but if you mean just disconnecting PlayerAdded and PlayerRemoving, I don’t know how that will solve the problem.
I think they mean calling playerAdded / playerRemoving with the player as the argument, but not actually removing it, so after a delay in the script, do something like this:
PlayerRemoving(plr)
wait(1)
PlayerAdded(plr)