local passId = 389373250 -- Change this to your game pass' ID
local GPS = game:GetService("GamePassService")
local lighting = game.Lighting
local hmg = {lighting.HMG, lighting.GHMG}
script.Parent.Touched:connect(function(part)
if game.Players:FindFirstChild(part.Parent.Name) then
local player = game.Players[part.Parent.Name]
if GPS:PlayerHasPass(player, passId) then
if player.Backpack:FindFirstChild(hmg[2].Name)==nil or player.StarterGear:FindFirstChild(hmg[2].Name)==nil then
hmg[2]:Clone().Parent = player.Backpack
hmg[2]:Clone().Parent = player.StarterGear
else
if player.Backpack:FindFirstChild(hmg[1].Name)==nil and player.StarterGear:FindFirstChild(hmg[1].Name)==nil then
hmg[1]:Clone().Parent = player.Backpack
hmg[1]:Clone().Parent = player.StarterGear
end
end
end
end
end)
So i think the problem is the "FindFirstChild" lines, because it only works for the first player to touch the giver. But how can i adjust this so that anyone who touches this button, can get either the HMG, or the GHMG if they have the pass. Help?
