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

Gamepass and Gamepass Service Help: Is it right?

Asked by 10 years ago

Does this seem right?

gps = game:GetService("GamePassService");
local PassId = script.Parent.Parent.Parent.Parent.Settings.PassId.Value
Tools = {"HoverBoard"}
Respawn_With_Tools = true
--Prompts the player to purchase the GamePass
script.Parent.MouseButton1Click:connect(function(player)
    Game:GetService("MarketplaceService"):PromptPurchase(player,PassId)
end)

game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()
if gps:PlayerHasPass(Player , id.Value) then
for i,v in pairs (game.Lighting:GetChildren()) do
for a,c in ipairs (Tools) do
if v:IsA'Tool' and v.Name:lower()==c:lower() then
adminTool = v:Clone()
if Respawn_With_Tools==true then
adminTool.Parent=Player.StarterGear
adminTool:Clone().Parent=Player.Backpack
elseif Respawn_With_Tools==false then
adminTool.Parent = Player.Backpack
end
end
end
end
end
end)

----

script.Parent.Text = "Purchase " .. script.Parent.Parent.Parent.Settings.PassName.Value

1 answer

Log in to vote
-1
Answered by
yurhomi10 192
10 years ago
script.Parent.MouseButton1Click:connect(function(player)

I don't think you can figure out who clicked it, unless you applied this event in a local script.

0
It doesn't have to be in a local script. ultrabug 306 — 10y
0
What is wrong then. It is not working. seanconnoll 9 — 10y
Ad

Answer this question