Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Updating a Radio Gamepass ?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)
0
You should update your question not post this as an answer. If this is solved then add [Solved] to the question title. User#5423 17 — 5y
Ad

Answer this question