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

How can i add a VIP feature to my class GUI?

Asked by 9 years ago

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.

0
We don't make scripts for you EzraNehemiah_TF2 3552 — 9y
0
I wasn't asking you to make me a script, i was asking you how i can change my existing one. So if you aren't going to listen, then dont comment on my post please. kelimeguy 60 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I have found a simple way to check for gamepasses by using a function that returns a boolean value. You can use it with an if statement.

--Place the function at the top of your script
function HasPass(plr, id)
    return game.GamePassService:PlayerHasPass(plr, id)
end

--Place this if statement where you want it and have code in it like so...
if HasPass(player, GAMEPASSIDHERE) then --Replace GAMEPASSIDHERE with the Gamepass ID
    --Code goes here
end

I'm assuming you want to place the if statement at line 24, with line 24's code in the if statement. If I am mistaken then let me know and I'll try to help you in the best way I can!

Did this help you? Accept my answer so we can both get reputation!

0
Wouldn't that just make the whole class system for VIPs? I'm trying to edit it so only one class is for VIPs. I'm not very good with gamepasses, so it is hard for me. kelimeguy 60 — 9y
0
Er, make sure you put the code for only the part that is for the VIP class. Can you not do that? lightpower26 399 — 9y
Ad

Answer this question