I have a Radio gamepass that I am trying to modernize. It is a older fashioned script and I wanted to update and ran into a problem.
I receive no errors but I don't seem to have the radio at all
local MarketplaceService = game:GetService("MarketplaceService") local Players = game:GetService("Players") local gamePassID = local function onPlayerAdded(parent, childName) assert(parent, "ERROR: WaitForChild: parent is nil") while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end game.Players.PlayerAdded:connect(function(player) local MarketplaceService = game:GetService('MarketplaceService') local PlayersService = game:GetService('Players') local GamePassIdObject = onPlayerAdded(script, 'gamePassId') player.CharacterAdded:connect(function(char) if player.Character.Name == "" or MarketplaceService:UserOwnsGamePassAsync (player.UserId, gamePassID) then require(game:GetService("ReplicatedStorage"):WaitForChild("GiveRadio"))(player) end end) end)
Thanks in advance!
Realized I could have left the old code i had and updated it..
rip
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 game.Players.PlayerAdded:connect(function(player) local GamePassService = game:GetService('MarketplaceService') local PlayersService = game:GetService('Players') local GamePassIdObject = script:WaitForChild('GamePassId') player.CharacterAdded:connect(function(char) if GamePassService:UserOwnsGamePassAsync(player.userId, GamePassIdObject.Value) then require(game:GetService("ReplicatedStorage"):WaitForChild("RADIOISMINE"))(player) end end) end)