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

Trying to make it continue the script or skip 10 seconds if play has GP, help?

Errors: None

local SkipAnimID = 944401378
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, SkipAnimID) then
	print("Worked")
    else
        wait(10)
    end
end)

2 answers

The function PlayerOwnsAsset no longer works with game passes or badges so you now must use the corresponding service to check this kind of data.

All you need to do is change this script to use the function PlayerHasPass which is only accessible on the server side.

Example, serser script:-

local gamePassServ = game:GetService('GamePassService')

game.Players.PlayerAdded:connect(function(plr)
	if gamePassServ:PlayerHasPass(plr, 944401378) then
		-- You may also need a remote event to let the player know they have the gamepass
	else
		wait(10)	-- ??
	end
end)

I hope this helps.

Hi.

If this is a server script located inside of a GUI and FE is enabled, the script will not work. If this is local script, it will not work.

However you can make it work using a Server script and a remote event.

Here is an example:

--SERVER SCRIPT inside of ServerScriptService

local Event = Instance.new("RemoteEvent")
Event.Parent = game:WaitForChild("ReplicatedStorage")
Event.Name = "SkipAnim"

local SkipAnimID = 944401378
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, SkipAnimID) then
	    Event:FireClient(player)
    else
        wait(10)
    end
end)

--LOCAL SCRIPT inside of GUI

game:WaitForChild("ReplicatedStorage").
local Event = game.ReplicatedStorage:FindFirstChild("SkipAnim")

Event.OnClientEvent:connect(function(player)
	print ("Player has pass")
	--The rest of code goes here
end)

Hope this helps!

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