So I have my screen gui here and inside is my script, and it looks like this:
player = script.Parent.Parent.Parent
backpack = player.Backpack
function chooseClass(class)
for i, v in pairs(backpack:GetChildren()) do v:remove() end
for i, v in pairs(class:GetChildren()) do
if v:IsA("Tool") then
v:clone().Parent = backpack
elseif v:IsA("HopperBin") then
v:clone().Parent = backpack
end
end
script.Parent.Main.Visible = false
script.Parent.Title.Visible = false
end
function onHumanoidDied(humanoid, player)
script.Parent.Main.Visible = true
script.Parent.Title.Visible = true
end
for i, v in pairs(script.Parent.Main:GetChildren()) do
v.MouseButton1Up:connect(function () chooseClass(v) end)
end
And then there is also a frame inside the screen gui with text buttons and tool inside them.
What I need is a feature where one of the buttons is connected to a gamepass and if you own the gamepass you get the tools inside it. Please help me create a script and tell me where to place it.
