Leaderstat Error

Ello! For some reason i’m getting an error for the leaderstats which I can’t even read. It refuses to minus the value from the leaderstats.

Error:

Players.TheKman2019.PlayerGui.GunShopUI.Main.Guns.ITEM1.$INTERACTION.GiveGun:7: attempt to perform arithmetic (sub) on Instance and number  -  Server - GiveGun:7

Script:

local RS = game:GetService("ReplicatedStorage")
local WeaponLocation = RS.Weapons.R700 -- Change to add new gun
local Cost = script.Parent.Parent["$MONEY"]

script.Parent.OnGunBought.OnServerEvent:Connect(function(player)
	player.leaderstats.Bank -= Cost.Value -- Error right here
	WeaponLocation:Clone()
	WeaponLocation.Parent = player.Backpack
	
	print("Player has bought the "..WeaponLocation..".")
end)
1 Like

It should be player.leaderstats.Bank.Value -= Cost.Value.

1 Like

Can’t believe I forgot to do this…

Thanks!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.