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

VIP bool value not being created why is this?

I'm creating values in a player for easier game use, and the VIP(lines 10-14), bool values aren't being created or turned to true. I own these items and I don't know what is wrong.

local mps = game:GetService("MarketplaceService")

function Validate(Players)
	if
		Players:IsInGroup(1200769) then
		local tag = Instance.new("BoolValue",Players)
		tag.Name = "RobloxStaff"
		tag.Value = true
	elseif
		mps:UserOwnsGamePassAsync(Players.UserId, 7222195) then
		local tag = Instance.new("BoolValue",Players)
		tag.Name = "VIP"
		tag.Value = true
	elseif
		Players:IsInGroup(4475945) then
		local tag = Instance.new("BoolValue",Players)
		tag.Name = "Fan"
		tag.Value = true
	elseif
		mps:UserOwnsGamePassAsync(Players.UserId, 0) then	
		local tag = Instance.new("BoolValue",Players)
		tag.Name = "GPPACK1"
		tag.Value = true		
	end
end

game.Players.PlayerAdded:Connect(Validate)

for i,Player in pairs(game.Players:GetPlayers()) do
	Validate(Player)
end

5 comments

0

Why don't you just have these values already in a player when a player joins so you don't need to create new ones every single if statement? Then each gamepass check would just turn them false or true.

0

Also recheck to see if you've got the right gamepass ID

0

Well I tested your script and it works. I changed the gamepass id to my gamepass and it detects that i have it and created the tag for me. I assume that u dont have the gamepass. You should mayb double check.

0

This is yet another example of using value objects where a Lua table should be used. ValueObjects were meant for authoring-time configuration, not so you can use a 60+ byte Instance to store a boolean.

0

@EmilyBendsSpace I'm going to use a model full of StringValues as a table of strings and you can't stop me!

1 answer

A silly mistake I'm creating a group game and I forgot to buy the pass

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