Help. Stuff is not working. I need help ASAP

I am making a script where if you are seated you get money.

Localscript:

 local character = script.Parent
print(character)
local humanoid = character:WaitForChild("Humanoid")
local repStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = repStorage:WaitForChild("GiveThatCashBaby")


function onSeated(isSeated, seat)
	if isSeated then
		print('player sat down')
		RemoteEvent:FireServer()
		
	else
			print("I'm not sitting on anything")
	end
end
humanoid.Seated:Connect(onSeated)

Server Script

local repStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = repStorage:WaitForChild("GiveThatCashBaby")

local function GiveMoney()
	print('Giving Money')
	while true do
		wait(10)
		game.Players.LocalPlayer.leaderstats.Balance = game.Players.LocalPlayer.leaderstats.Balance + 100
		print('gave 100')
	end
end

RemoteEvent.OnServerEvent:Connect(GiveMoney)
local repStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = repStorage:WaitForChild("GiveThatCashBaby")

local function GiveMoney(player)
	player.leaderstats.Balance.Value += 100
end

RemoteEvent.OnServerEvent:Connect(GiveMoney)

No this dose not work, the value of money dose not go up.

You were trying to use “game.Players.LocalPlayer” in a server script (it isn’t defined in server scripts), you were also trying to add 100 to the IntValue instance itself as opposed to the value stored inside the IntValue, you can access the value by appending .Value at the end & finally whenever the client fires the server by calling FireServer() through a RemoteEvent instance the player object pertaining to that particular client is automatically passed as an argument to any callback connected to the corresponding OnServerEvent event listener.

Can you share the leaderstats script then as something else must be broken?

Here you go

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local CashBalance = Instance.new("IntValue")
	CashBalance.Name = "Balance"
	CashBalance.Value = 1000
	CashBalance.Parent = leaderstats
end)

This seems fine, is the local script inside StarterCharacterScripts?

In deed it is. (gotta write more lol)

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local repStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = repStorage:WaitForChild("GiveThatCashBaby")

function onSeated(isSeated, seat)
	if isSeated then
		print('player sat down')
		RemoteEvent:FireServer()

	else
		print("I'm not sitting on anything")
	end
end
humanoid.Seated:Connect(onSeated)

Fantastic! Its working. Could you share the code so the player gets 100 every 15 seconds?

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local repStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = repStorage:WaitForChild("RemoteEvent")
local isInSeat = false

function onSeated(isSeated, seat)
	if isSeated then
		isInSeat = true
		task.spawn(function()
			while isInSeat do
				RemoteEvent:FireServer()
				task.wait(15)
			end 
		end)
	else
		isInSeat = false
	end
end

humanoid.Seated:Connect(onSeated)

@fortnite1_01 mark his reply as the solution since it helped you

That remote event can easily be exploited.

Do you know how I could detect if they stoped sitting and stop giving the money