local MarketPlaceService = game:GetService("MarketplaceService") local players = game:GetService("Players")
local gamePassID = (12940852)
function Spawned(player)
local HasGamepass = false local success, message = pcall(function() HasGamepass = MarketPlaceService:UserOwnsGamePassAsync(player.userid, gamePassID) end) if not success then warn("Checking in player has gamepass" ..tostring(message)) return end if HasGamepass == true then game.ServerStorage.(AdminBoombox):Clone().Parent = Player.backpack end
end
if HasGamepass == true then game.ServerStorage.(PompousTheCloud):Clone().Parent = Player.backpack end end
if HasGamepass == true then game.ServerStorage.(BoomBox):Clone().Parent = Player.backpack end end
game.Players.PlayerAdded:Connect(function(player) player.CharterAdded:connect(function() Spawned(player) end) end)
players.PlaySpawned:connect(Spawned)
game.ServerStorage.(AdminBoombox)
This won't work ^
Instead try this:
game.ServerStorage["(AdminBoombox)"]
or
game.ServerStorage:WaitForChild("(AdminBoombox)")
With the above answer its almost correct. Just need to grab the name of the things you're cloning
Assuming this is a cut up function because of the extra end I would change your script from the following:
local HasGamepass = false local success, message = pcall(function() HasGamepass = MarketPlaceService:UserOwnsGamePassAsync(player.userid, gamePassID) end) if not success then warn("Checking in player has gamepass" ..tostring(message)) return end if HasGamepass == true then game.ServerStorage.(AdminBoombox):Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage.(PompousTheCloud):Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage.(BoomBox):Clone().Parent = Player.backpack end end game.Players.PlayerAdded:Connect(function(player) player.CharterAdded:connect(function() Spawned(player) end) end) players.PlaySpawned:connect(Spawned)
To:
local HasGamepass = false local success, message = pcall(function() HasGamepass = MarketPlaceService:UserOwnsGamePassAsync(player.userid, gamePassID) end) if not success then warn("Checking in player has gamepass" ..tostring(message)) return end if HasGamepass == true then game.ServerStorage[AdminBoombox.Name]:Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage[PompousTheCloud.Name]:Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage[BoomBox.Name]):Clone().Parent = Player.backpack end end game.Players.PlayerAdded:Connect(function(player) player.CharterAdded:connect(function() Spawned(player) end) end) players.PlaySpawned:connect(Spawned)
The only way the new code won't work is if your Values AdminBoombox, PompousTheCloud, BoomBox
are not objects and are string(names)
If that is the case then just change your code to look like this:
-- .... previous code if HasGamepass == true then game.ServerStorage["AdminBoombox"]:Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage["PompousTheCloud"]:Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage["BoomBox"]:Clone().Parent = Player.backpack end end game.Players.PlayerAdded:Connect(function(player) player.CharterAdded:connect(function() Spawned(player) end) end) players.PlaySpawned:connect(Spawned)
of if this is still not the case then try this
-- .... previous code if HasGamepass == true then game.ServerStorage[AdminBoombox]:Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage[PompousTheCloud]:Clone().Parent = Player.backpack end end if HasGamepass == true then game.ServerStorage[BoomBox]:Clone().Parent = Player.backpack end end game.Players.PlayerAdded:Connect(function(player) player.CharterAdded:connect(function() Spawned(player) end) end) players.PlaySpawned:connect(Spawned)
hope this helps!