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

How to make a gui's script not be disabled if player owns a gamepass?

I tried doing this on my script no output errors

local id = 4594022
game.Players.PlayerAdded:connect(function(player)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, id) then
	script.Parent.Script.Disabled = false
end
end)

1 comment

0

Instead of disabling/enabling the script, why not disable/enable the gui itself?

1 answer

That script wouldn't work because of the way you're checking for passes. I suggest using this instead and looking at Abilities and Bonuses for more information.

local id = 4594022
game:GetService("Players").PlayerAdded:Connect(function(Player)
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, id) then
		script.Parent.Script.Disabled = false -- This would not work if the global script is in the Gui and FilteringEnabled is set to true.
	end
end)

Another thing, is the game FilteringEnabled? If it is this would not work because global scripts do not work in Guis when it is enabled. I suggest using a RemoteEvent instead.

1 comment

0

It isnt in filteringenabled and i have no idea how remoteevents work.

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