Hello guys, it’s me again, today i’m working with a new project…
so, i’ve created a “IntValue” in the leaderstats for player money, and i made a GUI with a tool.
But when i click to buy the tool the Server recieve’s the Signal, but the player money doesnt don’t decrease.
Here’s the Localscript:
local RP = game:GetService("ReplicatedStorage")
local Buy = RP:WaitForChild("Buy")
script.Parent.MouseButton1Click:Connect(function()
Buy:InvokeServer()
end)
And the Serverscript
local replicatedStorage = game:GetService("ReplicatedStorage")
local buy = replicatedStorage:WaitForChild("Buy")
local Bread = 5
buy.OnServerInvoke = function(player)
print ("Server Event: Bread")
local MoneyP = player.leaderstats.Money.Value
if MoneyP >= Bread then
MoneyP = MoneyP - 5
print ("Here's Your Bread")
else
print ("You not Enough Money")
end
end
The Server receives the message but when i write MoneyP = MoneyP - 5, the script just doesn’t remove 5 from the player’s money