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

How do I make this to get the gun plus a knife and a greanade please help?

Asked by
Krlos21 45
10 years ago

~~~~~~~~~~~~~~~~~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) ~~~~~~~~~~~~~~~~~

0
Oh and sorry if it's not in luacude i dont know how to do it help me with that please. Krlos21 45 — 10y

1 answer

Log in to vote
1
Answered by
hiccup111 231 Moderation Voter
10 years ago

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

"~~~~~~~~~~~"

0
Thank you for the help, and yes it does use a GUI and text button :D Krlos21 45 — 10y
Ad

Answer this question