So im trying to figure out how to get the player with a server script my game is a solo game so i feel like looping through all the players constantly would be useless is there a better way?
my attempt
local plr = game.Players:WaitForChild("Player") print(plr.Name)
this waits forever until it yields ;'/
Try this. I haven’t tested it yet.
Good luck.
Players = game:GetService("Players") for i, player in pairs(Players:GetPlayers()) do print(player.Name) end
To get a player you do:
game.Players.PlayerAdded:Connect(function(player) —gets player —code end)
If you know the name of the player you're going to be looking for just do
for i, v in pairs(game.Players:GetChildren()) do if v.Name == "NameOfWhoYouWant" then --Code you want to use break --So it stops since you already found who you want end end