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

Class Giver GUI, Multiple Tool giver, edit?

Asked by
BryanFehr 133
5 years ago

My code:

local player = game.Players.LocalPlayer -- Refer to the Player
local tool = game.ReplicatedStorage.Sword -- Refer to the Tool
script.Parent.MouseButton1Down:connect(function() -- When it's clicked
if player:FindFirstChild("Backpack") then -- Not sure why I added this
    tool:Clone().Parent = player.Backpack -- Clone the tool to their inventory
end -- End the if function
end) -- End the MouseButton1Down function

How would I go about editing this code, to make it so that in the ReplicatedStorage, it will give more than just one tool. Like two sowrds instead of one? Or, if using guns, An AK47 and Pistol, on click of the Text Gui?

0
Can you format your code into a code block Protogen_Dev 268 — 5y
0
I did. BryanFehr 133 — 5y
0
doesnt look like it to me. Though it could just be broken on firefox Protogen_Dev 268 — 5y

1 answer

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

So you would just do

local player = game.Players.LocalPlayer -- Refer to the Player
local tool = game.ReplicatedStorage.Sword -- Refer to the Tool
local toolAnother = game.ReplicatedStorage.DifferentSword -- Refer to another tool

script.Parent.MouseButton1Down:connect(function() -- When it's clicked

if player:FindFirstChild("Backpack") then -- Not sure why I added this
tool:Clone().Parent = player.Backpack -- Clone the tool to their inventory
toolAnother:Clone().Parent = player.Backpack -- Clone another tool to their inventory

end -- End the if function
end) -- End the MouseButton1Down function
1
Smh Ziffixture 6913 — 5y
0
Im sorry what the hell is this User#24403 69 — 5y
Ad

Answer this question