Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

my else if statement isn't working?

Asked by
zomspi 541 Moderation Voter
5 years ago

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)

0
Your writing else if as two words, for an else if statement to work you need to type it as one word. SpacePuppyMan 31 — 5y
0
What do you mean by that? do I need to remove the second else? zomspi 541 — 5y
1
Instead of writing 'else if' as two separate words, trying writing them as one word 'elseif' SpacePuppyMan 31 — 5y
0
ok zomspi 541 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

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)
0
Thanks so much that worked! zomspi 541 — 5y
0
No problem :) SpacePuppyMan 31 — 5y
Ad
Log in to vote
0
Answered by
zomspi 541 Moderation Voter
5 years ago

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)

Answer this question