Need Help With Firing Remotes From A Tool

So I have this tool I want it soa s you click to get a certain amount of loot. I have a local script in the Sword tool and a module script function to give the money. The local script calls a remote called MoneyGiver from the tool in the starterpack and a script handler in serverscriptservice determines whether the remote is called using OnServerEvent and calls a global function in the modulescript. I have a problem with this since when I click it only works in studio not the actual game in roblox Player.

(Sorry if code is hard to read i have no idea how to arrange them)

Local Script In Tool -- MoneyMaker

local Tool = script.Parent
local fired = false
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Tool.Equipped:Connect(function()
fired = true
end)
Tool.Unequipped:Connect(function()
fired = false
end)
Mouse.Button1Down:Connect(function()
if fired then
game:GetService(“ReplicatedStorage”).MoneyGiver:FireServer()
fired = false
wait(0.6)
fired = true
end
end)

Event Handler -- In ServerScriptStorage

local GoldManager = require(game.ServerStorage:WaitForChild(“GoldManager”))
game.ReplicatedStorage.MoneyGiver.OnServerEvent:Connect(function(Player)
GoldManager.GiveLoot(Player)
end)

The Module -- MoneyManager

local GoldManager = {}
function GoldManager.GiveLoot(Noob)
if Noob then
local Leaderstats = Noob:WaitForChild(“leaderstats”)
local Loot_per_Click = Noob:WaitForChild(“LootPerClick”)
if Loot_per_Click and Leaderstats then
Leaderstats.Loot.Value = Leaderstats.Loot.Value + Loot_per_Click.Value
print(“Money Given!!!”)
end
else
print(“There was an error!”)
end
end
return GoldManager

Remote Event -- In ReplicatedStorage

–No remote emoji lol –

I tried even to use a script instead of a localscript since I argued that when the tool is equipped it is parented to the character model. But, still didnt work I need help urgently. Thank you

Do you get any errors? Press F9 in the game and you’ll have access to both the client and server log.

Also regarding the script formatting, put your script between two sets of 3 backticks (```) and it’ll format it in Lua.

Example:
```
function remove()
script.Parent = nil
end
```
becomes

function remove()
    script.Parent = nil
end

It is currently printing the ‘money given’ log in the server logs but not giving cash at all

Nvm i solved it. Apparently, the scripter handling the Lootperclick value did something wrong parenting it.