So I am trying to make a shop and how would I be able to make it so that when you click a text button it checks you have 75 Blocks(the leaderstat) and if it does, it takes away 75,
local Button = script.Parent local Player = game:GetService("Players").LocalPlayer Button.MouseButton1Click:Connect(function() if Player.leaderstats.Blocks.Value >= 75 then -- Checks if player have 75 or more blocks Player.leaderstats.Blocks.Value -= 75 -- Takes away 75 blocks from the player end end)
This code uses the MouseButton1Click
event, which is triggered when a button is clicked. After you click it checks if you at least have 75 blocks, if so, it takes away 75 blocks from the player.
However, this is a really basic script. If you require future assistance, I recommend you check out some Roblox tutorials to gain familiarity with the subject.