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

2 comments
It doesn't have to be in a local script.
What is wrong then. It is not working.