player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent price = 30 coin = player.leaderstats.Simucoins tool = game.ServerStorage.BShopUpgrades:FindFirstChild("RoTopR") info = script.Parent.Parent function BuyU1() if coin.Value >= price then coin.Value = coin.Value - price local clone = tool:Clone() clone.Parent = player.Backpack local clone2 = tool:Clone() clone2.Parent = player.StarterGear script.Disabled = true end end script.Parent.MouseButton1Click:Connect(BuyU1)
Whenever I press the button, my currency hasn't been taken and i haven't got my item. I'm confused, when i looked at my output it turned no results.
For My Gui: HShopGui (ScreenGui) > Frame (Frame) > Info (Frame) > BuyU1 (TextButton) > BuyUpgrade1 (Script).
Hello I didn't know if you're Code was a Script or LocalScript so I made you a script that I tested and works. It is more different than yours, but people have different styles of Coding/Scripting.
Script:
-- Locals: local Player = game.Players.LocalPlayer local Price = 30 local Coin = Player.leaderstats:WaitForChild("Simucoins") local Tool = game.ReplicatedStorage.BShopUpgrades:FindFirstChild("RoTopR") script.Parent.MouseButton1Click:Connect(function() if Coin.Value > Price then Coin.Value = Coin.Value -Price Tool:Clone().Parent = Player.Backpack Tool:Clone().Parent = Player.StarterGear print("Bought") -- Prints script.Disabled = true else print("You Need "..Price -Coin.Value) -- If you don't have enough it will print how much you need end end)
By the way just to let you know this isn't a Script this is an Localscript enjoy!
If you need anymore help add me on ROBLOX or just add me on discord hoesbemad.#8403