Hey! I've been wondering how to get the players in my game but make it ignore myself. I'm pretty sure this is a simple couple line script. I've tried GetPlayers(), game.Players:GetChildren(), etc... Nothing really works. I've also tried the "for i,v in pairs()) do" thing.
Hey quack,
LocalScript
(client-side of course) and loop through all the players and put an if statement in the loop to check if the player that it's currently looping through has the same name as the LocalPlayer
's. If it doesn't, then you can go ahead and execute the rest of the code. Easier shown than just explaining so, check the code below and I'll explain line by line, unless it's obvious.local plrs = game:GetService("Players"); -- Players Service. local plr = plrs.LocalPlayer; function check_plrs() for _, plr2 in next, plrs:GetPlayers() do -- For each iteration, :GetPlayers() returns a table with all of the players inside of it. if plr2.Name ~= plr.Name then -- Checks if the current player it's looping through is the LocalPlayer or not. print("It's not me; it'", plr2.Name.."."); end end end