Cash gui doesn't work

I know I made a post about this but this is a new issue
I made a remote event that tells the client to update the gui to the coins value whenever a zombie dies in the output it says
FireClient: player argument must be a Player object

1- I don’t know how to increase the Coins value to 5 after a zombie dies
2-I don’t know how to update the gui to the coins value

Here is my code:

Server

local Coins = game.ReplicatedStorage.Coins
local player = game.Players

script.Parent.Died:Connect(function()
	game.ReplicatedStorage.ZombieAmount.Value -= 1
	Coins:FireClient(player)
end)

Client

local coin = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Coin")
local Coins = game.ReplicatedStorage.Coins
script.Parent.Text = coin.Value

Coins.OnClientEvent:Connect(function(player)
	coin.Value += 5
end)

coin.Changed:Connect(function()
	script.Parent.Text = coin.Value
end)

Additional info

I have a data store script in server script service

-- Setting data store
local DataStore = game:GetService("DataStoreService")
local PlayersData = DataStore:GetDataStore("PlayersData")

-- Making the coin when the player joins
game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local Streak = Instance.new("IntValue")
	Streak.Name = "Streak"
	Streak.Parent = leaderstats
	
	local coin = Instance.new("IntValue")
	coin.Name = "Coin"
	coin.Parent = leaderstats
end)

-- Saving the coin
game.Players.PlayerRemoving:Connect(function(player)
	local success, errormessage = pcall(function()
		PlayersData:SetAsync(player.UserId.."-cash", player.leaderstats.Cash.Value)
	end)
	if success then
		print("Player's data successfully saved")
	else
		print("Bruh")
		warn(errormessage)
	end
end)

In your server script, instead of referencing a player, you just reference the Players Service. You have to point the variable to a specific player instance.

So game:GetService(“Players”) right?

Well, I tried to put game:GetService(“Players”) instead but it still shows the exact same error in the output

That is not the issue here.

I assume, your Script is parented to a character’s humanoid.
In this case, you can get the player from the character.

script.Parent.Died:Connect(function()
	local character = script.Parent.Parent
	local player = game.Players:GetPlayerFromCharacter(character)

	game.ReplicatedStorage.ZombieAmount.Value -= 1
	Coins:FireClient(player)
end)

Actually its parented to the zombies Humanoid

stop accessing player from server script, you cant do that instead you should fire remote event from client to server, server gets player variable (automatically added, you dont have to add that during FireServer()) and then make the server change the cash.

umm no, he wants the player not players service

also, how would you know which player killed the zombie???

Any player that killed a zombie gets coins
I honestly don’t know

any? everyone gets a coin everytime someone killed a zombie?

Try this for the data store script:

local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local playerData = DataStoreService:GetDataStore("PlayerData")



local function onPlayerJoin(player)  -- Runs when players join

	local leaderstats = Instance.new("Folder")  --Sets up leaderstats folder

	leaderstats.Name = "leaderstats"

	leaderstats.Parent = player



	local Streak = Instance.new("IntValue" , leaderstats) --Sets up value for leaderstats
    Streak.Name = "Streak"

	



	local Coin = Instance.new("IntValue" , leaderstats) --Sets up value for leaderstats
	Coin.Name = "Coin"



	local playerUserId = "Player_" .. player.UserId  --Gets player ID

	local data = playerData:GetAsync(playerUserId)  --Checks if player has stored data

	if data then

		Streak.Value = data['Streak']
        Coin.Value = data['Coin']

	else

		-- Data store is working, but no current data for this player

		Streak.Value = 0

		Coin.Value = 0

	end

end



local function create_table(player)

	local player_stats = {}

	for _, stat in pairs(player.leaderstats:GetChildren()) do

		player_stats[stat.Name] = stat.Value

	end

	return player_stats

end



local function onPlayerExit(player) 



	local player_stats = create_table(player)

	local success, err = pcall(function()

		local playerUserId = "Player_" .. player.UserId

		playerData:SetAsync(playerUserId, player_stats) 

	end)



	if success then
       warn('Successfully saved player data!')
	elseif not success then
		warn('There was an error saving the players data: ' .. err)
	end

end



Players.PlayerAdded:Connect(onPlayerJoin)

Players.PlayerRemoving:Connect(onPlayerExit)

No, if a player kills a zombie they get coins localy

Well because if a player purchased something in game that costs for example 400 coins
all players will lose 400 coins so i thought to fix that i must make it a local script

that’s quite unsecure and unreliable to do, use remote events instead

I am trying I don’t understand remote event especially the argument passed in
for example FireServer(What should I put here?)

FireServer(item). the item you want to purchase

(check the player’s coins in the server)

server:

local remote
local itemPricingList = {
    ["example"] = 100;
}

remote.OnServerEvent:Connect(function(player, item: string)
    if not itemPricingList[item] then return end

    if player.leaderstats.Coins.Value > itemPricingList[item] then
        -- do stuff
    end
end)

client:

local remote
local function purchase(item: string)
    remote:FireServer(item)
end

-- example usage
purchase("example")

Uncopylocked place with what you want (streaks work and so do coins):

Let me know if there are any issues!