I am working on a game and it needs a shop, I am using this script.
script.Parent.MouseButton1Click:connect(function()
local RS = game:GetService("ReplicatedStorage")
local item = RS:WaitForChild("Iron Sword")
local price = 85 -- Change Your Price Here
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
if stats.SoulFragments.Value == price then -- Change the Money to your Currency Name
stats.SoulFragments.Value = stats.SoulFragments.Value - price
local cloned = item:Clone()
local cloned2 = item:Clone()
cloned2.Parent = player.Backpack
cloned.Parent = player.StarterGear
end
end)
Though, the problem is, if I don't have EXACTLY 85 points, it doesn't give me the item. Is there anything I can do to fix it?

1 comment
Yeah, this is what you want to do.