-- someone please explain why it puts attempt to compare number with string in the output of this -- script. game.Players.LocalPlayer:WaitForChild("leaderstats") -- because it waits a while before it loads repeat wait() Player = game.Players.LocalPlayer Button = script.Parent Item = game.ReplicatedStorage:FindFirstChild("BombosSurvivalKnife") Cost = 1000 Money = Player.leaderstats.Robux 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)
You are using repeat wait() until incorrectly. Remove it, and use :WaitForChild()
repeat wait() until game.Players.LocalPlayer.Character repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(game.workspace) wait(1 / 20) -- the code above will repeat until the Player's Character is in game.Workspace and in Players -- WaitForChild:() is basically like :FindFirstChild(), but it waits until it finds the string name. If it doesn't, you get a error saying, 'infinite yield possible..' game.Players.LocalPlayer:WaitForChild("leaderstats") -- because it waits a while before it loads local Player = game.Players:WaitForChild(game.Players.LocalPlayer.Name) local Item = game.ReplicatedStorage:WaitForChild("BombosSurvivalKnife") local Button = script.Parent local Cost = 1000 local Money = Player.leaderstats.Robux 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)