Problem with buying an item

I have a problem with my buy system in my game. To buy an item the player must interact with a proximity prompt, here’s the script

local pp = script.Parent
local repstorage = game:GetService("ReplicatedStorage")
local remotes = repstorage.Remotes

pp.Triggered:Connect(function(player)
	remotes.Buy1:FireClient(player)
end)

The script fires a remote event ( in repstorage ) which then in another script ( in serverscript service ), the script creates a function for buying the item. here’s the script :

local repstorage = game:GetService("ReplicatedStorage")
local remotes = repstorage:FindFirstChild("Remotes")
local serverscriptservice = game:GetService("ServerScriptService")
local reEating = remotes.Eating
local PlayerData = require((serverscriptservice.PlayerData.Manager))

local function eatmoney(player: Player)
	PlayerData.AdjustMoney(player, 1)
end

local function buy1(player: Player)
	PlayerData.AdjustMoney(player, -10)
end

reEating.OnServerEvent:Connect(eatmoney)
remotes.Buy1.OnServerEvent:Connect(buy1)

and
local Manager = {}

Manager.Profiles = {} --profile, storing data

function Manager.AdjustMoney(player: Player, amount: number)
	local profile = Manager.Profiles[player]
	if not profile then return end
	profile.Data.Money += amount
	player.leaderstats.Money.Value = profile.Data.Money
end

return Manager

i have another system for getting the money and it works perfectly fine. But for some reason the buy system just doesnt work. Any suggestions on how to fix this?

idk if you have some other script that adds player to the Profiles table but if the table is always empty then this line

is always gonna return

oh yeah also here your using FireClient while youre supposed to use FireServer to send data to the server

try putting the local script in StarterGui or StarterPlayerScripts or StarterCharacterScripts

i was gonna use fireserver but for some reason the proximity prompt can’t work if it’s a local script

the proximity prompt won’t work if its a local script… for some reason.

ik it’s there to check if the player has a profile