My code is here, and I am using a script on line 20 is where the error is
local player = game.Players.LocalPlayer
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("IntValue",player)
leaderstats.Name = "leaderstats"
local Kills = Instance.new("IntValue",leaderstats)
Kills.Name = "Kills"
Kills.Value = 0
local Deaths = Instance.new("IntValue",leaderstats)
Deaths.Name = "Deaths"
Deaths.Value = 0
local Cash = Instance.new("IntValue",leaderstats)
Cash.Name = "Cash"
Cash.Value = 1000
end)
game.ReplicatedStorage.Bought.BoughtACR.OnServerEvent:Connect(function()
if player.leaderstats.Cash.Value >= 1000 then -- works until here
print("something")
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 1000
end
end)

1 comment
Also, just an added tip, This is a server script, so you won't be able to get the "LocalPlayer" for your variable at the top.