When I have 100 or more cash and try to buy the sword, the script doesn’t give it to me and prints ‘Not Enough Cash’ even though I have 100 or more cash.
Server Script:
game.ReplicatedStorage.Remotes.BuySword.OnServerEvent:Connect(function(player, cost)
local sword = game.ReplicatedStorage.Stuff:WaitForChild("ClassicSword"):Clone()
if player.leaderstats.Cash.Value >= cost then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - cost
sword.Parent = player.Backpack
else
print("Not Enough Cash!!")
end
end)
Local Script:
local player = game.Players.LocalPlayer
local BuySwordRemoteEvent = game.ReplicatedStorage.Remotes.BuySword
local cost = 100
script.Parent.MouseButton1Click:Connect(function()
BuySwordRemoteEvent:FireServer(cost)
end)