Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make it where if I have more than the price, it will still give the item?

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 answer

✓ Accepted answer

On line 08, instead of using == (equal to), use >= (greater than or equal to)

1 comment

0

Yeah, this is what you want to do.

This discussion is preserved as it was. New answers, comments, and votes are closed.