I have a game where the points in the leaderboard are 'Wins' for winning a round of the game. The Wins Value is found in Players > LocalPlayer > leaderstats > Wins. I have a shop, that is scripted onto a SurfaceGUI, where if you click the Bloxy Cola text button, it should clone the gear called 'BloxyCola' from the ReplicatedStorage in a Model called 'Gears' into the player's backpack, if they have 3 wins. However, when I click the button nothing happens. The code is in a LocalScript, and I have tried a normal script aswell, but still nothing works. The LocalScript is found in:
game.Workspace.Shop.ShopGUI.MainFrame.ItemFrame.BloxyColaButton.LocalScipt
where 'Shop' is a part, 'ShopGUI' is a SurfaceGUI, 'MainFrame' and 'ItemFrame' are frames, and 'BloxyColaButton' is a text button. Can someone please help me?
local player = game.Players.LocalPlayer
local wins = player:WaitForChild("leaderstats").Wins
script.Parent.MouseButton1Click:connect(function()
if wins.Value >= 3 then
game.ReplicatedStorage.Gears.BloxyCola:Clone().Parent = player.Backpack
end
end)

1 comment
I am pretty sure there may be something wrong with the script that puts the tool into the backpack of the player. I may be wrong but thats what im guessing. Anyways good question to ask.