Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How Can I Make A Script That Purchase One Time Only If A Player Already Have The Same Item?

Asked by
ImfaoXD 158
9 years ago

How can I make a script that purchase one time only when a player already have the item? Like for example; if you buy a link sword and you decided to buy the same one again, but you can't since you already have that link sword in your backpack. And also they will lose coins for how much they spend depending on how much the item costs. So how can I do that? Also this is for a normal script. Not a local script. Please help me guys.

01local player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
02local price = 1
03local tool = game.Lighting:findFirstChild("Teleport")
04 
05function picture()
06script.Parent.Parent.Picture.Image = "http://www.roblox.com/asset/?id=51067285"
07script.Parent.Parent.Price.Text = "$1"
08end
09 
10function buy()
11wait(0.1)
12local money = player.leaderstats.Coins
13if money.Value >= price then
14local a = tool:clone()
15a.Parent = player.Backpack
View all 24 lines...

Thank you for helping me.

1 answer

Log in to vote
4
Answered by 9 years ago

Make a bool value in the player, when they buy the item, make the value true, and add an if statement, eg.

1if player.Item.Value == true then
2print("All ready has item!")
3elseif player.Item.Value == false then
4--script to buy the item.
5end

Define you variables first, and this needs to be edited to work obviously.

If this helps you, accept this answer, it gives us both rep!

0
Basically what I'd say. RadiantSolarium 35 — 9y
0
Thank you, ScriptFusion and RadiantSolarium. :) ImfaoXD 158 — 9y
0
NP ScriptFusion 210 — 9y
Ad

Answer this question