I'm making a shooter, and I'm making a shop. The problem is, whenever I click on the shop item I'm trying to get, I don't get anything. Here's the script for the button:
repeat wait() Player = game.Players.LocalPlayer Button = script.Parent Item = game.ReplicatedStorage:FindFIrstChild("GravityCoil") Cost = 50 Money = Player.leaderstats.Money until Button.MouseButton1Down:connect(function(purchase) if Money.Value > (Cost - 1) then Money.Value = Money.Value - Cost local a = Item:Clone() a.Parent = Player.Backpack local b = Item:Clone() b.Parent = Player.StarterGear end end)
This is the script for the leaderboard I was using (I gave myself 50 money)
game.Players.PlayerAdded:connect(function(p) local stats = Instance.new("IntValue", p) stats.Name = ("leaderstats") local money = Instance.new("IntValue", stats) money.Name = "Money" money.Value = 50 end)
Thanks in advance!
The problem is that you're trying to look for FindFIrstChild
, which will give an error. Remember lua is case sensitive! By fixing that small spelling error, the script should work right for you.
Item = game.ReplicatedStorage:FindFirstChild("GravityCoil")