Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Updating a Radio Gamepass ?

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!

1 answer

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)

1 comment

0

You should update your question not post this as an answer. If this is solved then add [Solved] to the question title.

This discussion is preserved as it was. New answers, comments, and votes are closed.