I have been trying to figure this out for about 3-4 days now and it hasn't worked. I've tried putting the script in startercharacters, and in starterplayers, but nothing works. Here are the scripts I've attempted to use:
script no. 1 (modified "gamepass admin tools" script)
-- Waits for parent.child to exist, then returns it
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
-----------------
--| Variables |--
-----------------
local MarketplaceService = Game:GetService('MarketplaceService')
local PlayersService = Game:GetService('Players')
local InsertService = Game:GetService('InsertService')
local GamePassIdObject = WaitForChild(script, 'GamePassId')
function onPlayerEntered(player)
if MarketplaceService:PlayerOwnsAsset(player, GamePassIdObject.Value) then
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local weapon = char:WaitForChild('MetroidWeapons')
weapon.Disabled = false
end)
end)
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
script no. 2
local id = 4440659
local player = game.Player.LocalPlayer
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, id) then
game.Players.LocalPlayer.Character.MetroidWeapons.Disabled = false -- if player have the Pass, the script is enabled.
else
game.Players.LocalPlayer.Character.MetroidWeapons.Disabled = true -- if player don't have the Pass, the script is disabled.
end
Script no. 3 (placed in startercharacterscripts)
local id = 4440659
local player = game.Player.LocalPlayer
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, id) then
script.Parent.MetroidWeapons.Disabled = false -- if player have the Pass, the script is enabled.
else
script.Parent.MetroidWeapons.Disabled = true -- if player don't have the Pass, the script is disabled.
end

2 comments
Use the Lua feature to neatly pop your code in the question
Ah! Sorry, I'm new, didn't catch that feature. Thanks!