Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How Can I Make This GUI Giver Work If You Buy or Have a Gamepass/Shirt?

Heres The Script Ive Made That Gives It to You But Can Someone Add to It so It Cost a Gamepass/Shirt

local player = game.Players.LocalPlayer -- Refer to the Player
local tool = game.Lighting["AN-94"] -- Refer to the Tool
local frame = script.Parent.Parent

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
        frame.Visible = false
    end -- End the if function
end) -- End the MouseButton1Down function   

1 comment

1

You may want to read this article on the RobloxWiki: http://wiki.roblox.com/index.php?title=Game_pass

1 answer

local frame = script.Parent.Parent
local passid = 198479412 --put gamepass id here
local tools = {"AN-94", "Sample Weapon"} -- put the name of your tool here (put it in lighting)
local GamePassService = game:GetService('GamePassService')
local player = game.Players.LocalPlayer
repeat wait(0.1) until player.Backpack	
repeat wait(0.1) until player.StarterGear
script.Parent.MouseButton1Down:connect(function()
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
frame.Visible = false
end
end
end)

Untested. If this didn't work please tell me and I'll correct it. Anyways, here is a script I've provided for you.

2 comments

0

It Doesnt work ive editied it and it still wont work :/

0

Ok, I'll have a look at it.

This discussion is preserved as it was. New answers, comments, and votes are closed.