Player=script.Parent.Parent.Parent.Parent.Parent
script.Parent.Text=tostring(script.Parent.ItemName.Value)..": "..tonumber(script.Parent.Cost.Value).." "..tostring(script.Parent.Currency.Value)
script.Parent.MouseButton1Click:connect(function()
if Player:findFirstChild("leaderstats") then
if Player.leaderstats[script.Parent.Currency.Value].Value>=tonumber(script.Parent.Cost.Value) then
Player.leaderstats[script.Parent.Currency.Value].Value=Player.leaderstats[script.Parent.Currency.Value].Value-tonumber(script.Parent.Cost.Value)
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.Backpack
game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.StarterGear
end
end
end)
~~~~~~~``~~~~~~~~~~
✓ ANSWER ACCEPTED
How do I make this to get the gun plus a knife and a greanade please help?
1 answer
✓ Accepted answer
I'm guessing this is in a Gui Text Button?
It may be easier if you use a LocalScript for this sort of thing
--LocalScript--
Player = game.Players.LocalPlayer
WeaponList = game.ReplicatedStorage.Weapons -- Re-path if need.
Button = script.Parent
repeat wait() until Player:FindFirstChild("leaderstats")
cash = leaderstats.Cash --Player's Cash
Button.MouseButton1Up:connect(function()
if cash.Value >= Button.Cost.Value then
for _,v in pairs(WeaponList:GetChildren()) do
v:Clone().Parent = Player.Backpack
end
end
end)
Also, your code goes between
"~~~~~~~~~~~"
code
"~~~~~~~~~~~"
1 comment
0
Thank you for the help, and yes it does use a GUI and text button :D
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Oh and sorry if it's not in luacude i dont know how to do it help me with that please.