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

my else if statement isn't working?

I am trying to make chat tags, 3 different ones, VIP, MVP and MIVP. VIP and MVP have specific gamepasses and MIVP if both VIP and MVP gamepasses are purchased.

local MS = game:GetService("MarketplaceService")
local VIPID = 7187215
local VIPID1 = 7208245


game.Players.PlayerAdded:connect(function(plr)
	local tags = Instance.new("Folder", plr)
	tags.Name = "Tags"
	


		
	
    if MS:UserOwnsGamePassAsync(plr.UserId,VIPID1) and MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then
	local newTag = Instance.new("IntValue", tags)
		newTag.Name = "MIVP"								--- in the "Worthy" put what you want your tag to be
		local chatcolor = Instance.new("Color3Value", newTag)
		chatcolor.Name = "ChatColor"
		chatcolor.Value = BrickColor.new("Forest green"). Color
		local tagColor = Instance.new("Color3Value", newTag)
		tagColor.Name = "TagColor"
		tagColor.Value = Color3.fromRGB(31, 128, 29)
else if 
	 MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then				--- Replace GoogleResearch with your name
		local newTag = Instance.new("IntValue", tags)
		newTag.Name = "VIP"								--- in the "Worthy" put what you want your tag to be
		local chatcolor = Instance.new("Color3Value", newTag)
		chatcolor.Name = "ChatColor"
		chatcolor.Value = BrickColor.new("New Yeller"). Color
		local tagColor = Instance.new("Color3Value", newTag)
		tagColor.Name = "TagColor"
		tagColor.Value = Color3.fromRGB(255, 255, 0)
	
else if 
	MS:UserOwnsGamePassAsync(plr.UserId,VIPID1) then 					--- Replace GoogleResearch with your friends name
		local newTag = Instance.new("IntValue", tags)
		newTag.Name = "MVP"								--- in the "Worthy" put what you want your tag to be
		local chatcolor = Instance.new("Color3Value", newTag)
		chatcolor.Name = "ChatColor"
		chatcolor.Value = BrickColor.new("Toothpaste"). Color
		local tagColor = Instance.new("Color3Value", newTag)
		tagColor.Name = "TagColor"
		tagColor.Value = Color3.fromRGB(0, 255, 255)
end
	end
end
end)

(I used a model for some of the script)

4 comments

0

Your writing else if as two words, for an else if statement to work you need to type it as one word.

0

What do you mean by that? do I need to remove the second else?

1

Instead of writing 'else if' as two separate words, trying writing them as one word 'elseif'

0

ok

2 answers

✓ Accepted answer

Try this:

local MS = game:GetService("MarketplaceService")
local VIPID = 7187215
local VIPID1 = 7208245

game.Players.PlayerAdded:connect(function(plr)
    local tags = Instance.new("Folder", plr)
    tags.Name = "Tags"

	if MS:UserOwnsGamePassAsync(plr.UserId,VIPID1) and MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then
    	local newTag = Instance.new("IntValue", tags)
        	newTag.Name = "MIVP"                                --- in the "Worthy" put what you want your tag to be
        	local chatcolor = Instance.new("Color3Value", newTag)
        	chatcolor.Name = "ChatColor"
        	chatcolor.Value = BrickColor.new("Forest green"). Color
        	local tagColor = Instance.new("Color3Value", newTag)
        	tagColor.Name = "TagColor"
        	tagColor.Value = Color3.fromRGB(31, 128, 29)
	elseif MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then                --- Replace GoogleResearch with your name
        	local newTag = Instance.new("IntValue", tags)
        	newTag.Name = "VIP"                             --- in the "Worthy" put what you want your tag to be
        	local chatcolor = Instance.new("Color3Value", newTag)
        	chatcolor.Name = "ChatColor"
        	chatcolor.Value = BrickColor.new("New Yeller"). Color
        	local tagColor = Instance.new("Color3Value", newTag)
        	tagColor.Name = "TagColor"
        	tagColor.Value = Color3.fromRGB(255, 255, 0)
	elseif MS:UserOwnsGamePassAsync(plr.UserId,VIPID1) then                    --- Replace GoogleResearch with your friends name
        	local newTag = Instance.new("IntValue", tags)
        	newTag.Name = "MVP"                             --- in the "Worthy" put what you want your tag to be
        	local chatcolor = Instance.new("Color3Value", newTag)
        	chatcolor.Name = "ChatColor"
        	chatcolor.Value = BrickColor.new("Toothpaste"). Color
        	local tagColor = Instance.new("Color3Value", newTag)
        	tagColor.Name = "TagColor"
        	tagColor.Value = Color3.fromRGB(0, 255, 255)
	end
end)

2 comments

0

Thanks so much that worked!

0

No problem :)

I thought this would be better but nope, still doesn't work...

local MS = game:GetService("MarketplaceService")
local VIPID = 7187215
local VIPID1 = 7208245
local VIPID2 = 7208246

game.Players.PlayerAdded:connect(function(plr)
	local tags = Instance.new("Folder", plr)
	tags.Name = "Tags"
	


		
	
    if MS:UserOwnsGamePassAsync(plr.UserId,VIPID2) and MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then
	local newTag = Instance.new("IntValue", tags)
		newTag.Name = "MIVP"								--- in the "Worthy" put what you want your tag to be
		local chatcolor = Instance.new("Color3Value", newTag)
		chatcolor.Name = "ChatColor"
		chatcolor.Value = BrickColor.new("Forest green"). Color
		local tagColor = Instance.new("Color3Value", newTag)
		tagColor.Name = "TagColor"
		tagColor.Value = Color3.fromRGB(31, 128, 29)
if not MS:UserOwnsGamePassAsync(plr.UserId,VIPID2) and MS:UserOwnsGamePassAsync(plr.UserId,VIPID1) then 
	if MS:UserOwnsGamePassAsync(plr.UserId,VIPID) then				--- Replace GoogleResearch with your name
		local newTag = Instance.new("IntValue", tags)
		newTag.Name = "VIP"								--- in the "Worthy" put what you want your tag to be
		local chatcolor = Instance.new("Color3Value", newTag)
		chatcolor.Name = "ChatColor"
		chatcolor.Value = BrickColor.new("New Yeller"). Color
		local tagColor = Instance.new("Color3Value", newTag)
		tagColor.Name = "TagColor"
		tagColor.Value = Color3.fromRGB(255, 255, 0)
	
if not MS:UserOwnsGamePassAsync(plr.UserId,VIPID2) and MS:UserOwnsGamePassAsync(plr.UserId,VIPID2) then 
	
	if MS:UserOwnsGamePassAsync(plr.UserId,VIPID1) then 					--- Replace GoogleResearch with your friends name
		local newTag = Instance.new("IntValue", tags)
		newTag.Name = "MVP"								--- in the "Worthy" put what you want your tag to be
		local chatcolor = Instance.new("Color3Value", newTag)
		chatcolor.Name = "ChatColor"
		chatcolor.Value = BrickColor.new("Toothpaste"). Color
		local tagColor = Instance.new("Color3Value", newTag)
		tagColor.Name = "TagColor"
		tagColor.Value = Color3.fromRGB(0, 255, 255)
end
	end
end
end
end
end)

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