I have a funky script here that keeps giving me multiples of gamepass gear based on the number of players in the game. Say there’s 16 players in the game, the gamepass owner will get 16 of the same tool.
I’m pretty sure it has something to do this with script. Anyone know how to fix this. Any help is greatly appreciated, thanks!
--SERVICE LOCALS--
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local player = Players.LocalPlayer
--ID LOCALS--
local ID_bncr = 17791929 -- boombox 500R$
--GEAR LOCALS--
local Punch = game.ServerStorage.Gear.Punch
--BOUNCER GAMEPASS--
game.Players.PlayerAdded:Connect(function(player)
local success, message = pcall (function()
hasPass2 = MarketplaceService:UserOwnsGamePassAsync(player.UserId, ID_bncr)
end)
if hasPass2 then
for _, playerVal in pairs(game.Players:GetPlayers()) do
print("Player has BOUNCER gamepass")
Punch:Clone().Parent = player.Backpack
Punch:Clone().Parent = player.StarterGear
--GrabPlayer:Clone().Parent = player.Backpack
--GrabPlayer:Clone().Parent = player.StarterGear
end
end
end)