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

How do you make it if they have enough of cash they get an item added to their starter pack?

Asked by
Tizzel40 243 Moderation Voter
6 years ago

Like of their cash reaches 20 they get a sword and if it reaches 50 they get. Magic. (Btw i have a cash auto. Riser )

0
Use a conditional statement of the form "if Cash.Value == 20 then... ". Le_Teapots 913 — 6y
0
not constructive kek Fifkee 2017 — 6y

4 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Example: This is for 'SHOP'

player = script.Parent.Parent.Parent.Parent.Parent


local tool = game.ServerStorage:FindFirstChild("NAME OF TOOL HERE") -- Make sure to put the tool in ServerStorage!


Balance = 100 -- Set here how much money you want for this item to cost!


money = player.leaderstats.CURRENCY



-- This script uses TextButton, or ImageButton1
script.Parent.MouseButton1Click:connect(function()
if money.Value >= Balance then


local item = tool:Clone()
item.Parent = player.Backpack


money.Value = money.Value - Balance -- Remove this line if you want that you don't lose your money when you purchase this item! Otherwise, leave this!
end
end)


EXAMPLE: This is automatically giver.

-- VARIABLES

player = script.Parent.Parent.Parent.Parent.Parent


local tool = game.ServerStorage:FindFirstChild("NAME OF TOOL HERE") -- Make sure to put the tool in ServerStorage!


Balance = 100 -- Set here how much money you want for this item to cost!


money = player.leaderstats.CURRENCY


-- CODING

if money.Value >= Balance then

local item = tool:Clone()
item.Parent = player.Backpack

end

That's it, btw sorry for my bad English! If this script worked for you, feel free to accept my answer!

Ad
Log in to vote
0
Answered by 6 years ago

Use something along these lines

if Money.Value >= 20 then

 --or

if Money.Value >= 50 then
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Here is an example:

local item = game.ReplicatedStorage.item:clone
if Cash.Value >= 100 then
    item.Parent = game.Players.LocalPlayer.Backpack
end

Change things up a little if it didn't work. I'm just new to RBLX Lua.

0
lol your script is broken. Elixcore 1337 — 6y
Log in to vote
0
Answered by
Elixcore 1337 Moderation Voter
6 years ago
Edited 6 years ago
magic = game. -- put magic's path.
sword = game. -- put sword's path
money = game. -- put money's path
plr = game.Players.LocalPlayer

if money.Value >= 20 then
magic:Clone().Parent = plr.Backpack
end

if money.Value >= 50 then
sword:Clone().Parent = plr.Backpack
end
0
so what do you mean when you say path?do you mean replicated storage? Tizzel40 243 — 6y
0
for example let's say sword is located in ReplicatedStorage you do this game.ReplicatedStorage.sword Elixcore 1337 — 6y

Answer this question