local Lighting = game:GetService("Lighting") local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local badgeId = "2124428647" local toolNames = {"GhostBurger"} local toolsParent = Lighting local function onPlayerAdded(player) local function onCharacterAdded(character) if MarketplaceService:PlayerOwnsAsset(player.UserId, badgeId) then for i = 1, #toolNames do local tool = toolsParent:FindFirstChild(toolNames[i]) if tool then local clone = tool:Clone() clone.Parent = player.Backpack end end end end if player.Character then onCharacterAdded(player.Character) end player.CharacterAdded:Connect(onCharacterAdded) end Players.PlayerAdded:Connect(onPlayerAdded)
It is line 11, where it lists the player.UserId, badgeId.
First of all:
PlayerOwnsAsset
needs a player object, put you're passing string instead which causes the error.
Second of all:
The badge id must be an int, not a string:
local badgeId = 2124428647
Lastly:
UserHasBadgeAsync
of BadgeService is the appropriate function to use, not PlayerOwnsAsset.
if game:GetService('BadgeService'):UserHasBadgeAsync(player.UserId, badgeId) then