How do I get the local player from server without remote events

I can’t use the on player added because it is a game handler

I just need it for a small part

			local moneyPerWave = 10

			for i, v in pairs(alivePlrs) do
				if player.Name == v then
					player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + moneyPerWave
				end
			end
		end
1 Like

what do you mean game handler? Adding PlayerJoined should not effect the script at all.

Try adding:

game.Players.PlayerAdded:Connect(function()
       -- script here
end)

But when I do that, the round resets and it doesn’t give rewards

what do you need local player for?

I just need the player for rewarding them there cash at the end of the wave

you need specific players or all players to reward cash?

I need to check if the player are in the table of people still alive

1 Like

So you want to reward all the players that are in the table?
If that’s the case then it depends on what you’re storing in the alivePlrs table.
If you are storing the player object you should do

local moneyPerWave = 10

for i, v in pairs(alivePlrs) do
	v.leaderstats.Cash.Value = v.leaderstats.Cash.Value + moneyPerWave
end

If you are storing the name of the players then you need to do

local moneyPerWave = 10

for i, v in pairs(alivePlrs) do
	game.Players[v].leaderstats.Cash.Value = game.Players[v].leaderstats.Cash.Value + moneyPerWave
end

why is it now showing that the table doesn’t exist

That might be due to the variable scope, the alivePlrs table is probably in a diffrent block of code.

This might sound more complicated to you, but you can use module scripts to store the table of alive players and use functions that the server can use to award players.
Like the server script could access the module script by using for i, v in pairs loop.
Like do
for i,v in pairs(game:WaitForChild(“Players”):GetChildren())
moduleName.awardMoney(v)

Then in the module check if they are alive within the table and award money if they were alive during the round.

It doesn’t show it now but it just doesn’t work