Would this script work?

  1. What do you want to achieve?
    If the player has the Roblox Premium membership, the GUI is enabled.

  2. What is the issue?
    I can’t test whether or not the script actually works since I don’t have Roblox Premium so therefore I wanted to ask whether or not my script is written correctly on the DevForum to ensure that premium players have access.

local Players = game:GetService("Players")

local function onPlayerAdded(player)

	if player.MembershipType == Enum.MembershipType.Premium then
		print(player.Name .. " has premium membership")
		--game.StarterGui.Paint.Enabled = true
		player.PlayerGui.InventoryGui.Enabled = true
		game:GetService("BadgeService"):AwardBadge(player.UserId, 2130978100)
		-- Assign this player the ability or bonus related to the game pass
		--
		print(player.Name .. " BuildGUI enabled ")
	end
end

-- Connect "PlayerAdded" events to the "onPlayerAdded()" function
Players.PlayerAdded:Connect(onPlayerAdded)

Screen Shot 2023-04-08 at 12.42.06 PM

Yes you have right. It’s done just waiting premium players joins!

1 Like

The script is right? I’m not sure what you mean by:

Sorry, I just wanted to clarify and make sure!

He means that. The script is just waiting for premium players to join. Also you could’ve just used print statements to test it.

Basically, Meaning the script is just waiting for premium players to join the experience. To play it, and then it’d come into action if they have premium.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.