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

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

Asked by 7 years ago
Edited 7 years ago

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
You may want to read this article on the RobloxWiki: http://wiki.roblox.com/index.php?title=Game_pass XAXA 1569 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
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.

0
It Doesnt work ive editied it and it still wont work :/ ItzCarnage115555555 -3 — 7y
0
Ok, I'll have a look at it. PyccknnXakep 1225 — 7y
Ad

Answer this question