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

If this text then this color?

Asked by 9 years ago

So. I've got the script to make the chat, but I'm trying to do it where when a certain text is chatted, then that message changes color to correspond with it..

local messages = { -- was gonna try that.
    "[SERVER] Remember to thumbs up and favorite!";
    "[SERVER] Don't spam or be banned!";
    "[SERVER] Want mod or admin privileges, join the group!";
    "[SERVER] Remember we drive on the LEFT of the road!";
    "[SERVER] Remember to enjoy yourself.";
}

local colors = { --These are in order corresponding to "messages"
    Color3.new(255, 255, 224);
    Color3.new(255,0,0);
    Color3.new(135,206,235);
    Color3.new(255,255,224);
    Color3.new(135,206,235);
}

while wait()  do
        local r = math.random(1,5)
        game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
        Text = messages[r]; 
        Color = colors[r]; 
        Font = Enum.Font.SourceSansBold; 
        FontSize = Enum.FontSize.Size8;
        })
        wait(5)
    end

FOR CAIL

If Text = "[SERVER] Remember to thumbs up and favorite!" then Color3.new(255, 255, 224)

So, if the text says Say message 1, it will be the color of the first line in colors, get it?

Update:

I have tried this, but I keep getting "Expected identifier, got 'if'"

local colors = {
    if Text == "[SERVER] Remember to thumbs up and favorite!" then
            Color = Color3.new(255, 255, 224)
    elseif Text == "[SERVER] Don't spam or be banned!" then
            Color = Color3.new(255,0,0)
    elseif Text == "[SERVER] Want mod or admin privileges, join the group!" then
            Color = Color3.new(135,206,235)
    elseif Text == "[SERVER] Remember we drive on the LEFT of the road!" then
            Color = Color3.new(255,255,224)
    elseif Text == "[SERVER] Remember to enjoy yourself." then
            Color = Color3.new(135,206,235)
        end
}

So, it'd be in this case,

local messages = { -- was gonna try that.
    "[SERVER] Remember to thumbs up and favorite!";
    "[SERVER] Don't spam or be banned!";
    "[SERVER] Want mod or admin privileges, join the group!";
    "[SERVER] Remember we drive on the LEFT of the road!";
    "[SERVER] Remember to enjoy yourself.";
}

local colors = {
    if Text == "[SERVER] Remember to thumbs up and favorite!" then
            Color = Color3.new(255, 255, 224)
    elseif Text == "[SERVER] Don't spam or be banned!" then
            Color = Color3.new(255,0,0)
    elseif Text == "[SERVER] Want mod or admin privileges, join the group!" then
            Color = Color3.new(135,206,235)
    elseif Text == "[SERVER] Remember we drive on the LEFT of the road!" then
            Color = Color3.new(255,255,224)
    elseif Text == "[SERVER] Remember to enjoy yourself." then
            Color = Color3.new(135,206,235)
        end
}

while wait()  do
        local r = math.random(1,5)
        game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
        Text = messages[r]; 
        Color =
        Font = Enum.Font.SourceSansBold; 
        FontSize = Enum.FontSize.Size8;
        })
        wait(5)
    end
0
And once again: I don't understand you. Give an example of what you mean, instead of beating around the bush. CailThePuppy 70 — 9y
0
Okay TheHospitalDev 1134 — 9y
0
Your code is correct I don't see what you're trying to ask. CailThePuppy 70 — 9y
0
So, that's what I'm trying to ask... TheHospitalDev 1134 — 9y
0
Well, why would you do that? Your original code already worked. CailThePuppy 70 — 9y

1 answer

Log in to vote
2
Answered by 9 years ago

Rookie mistake

Color3.new(255, 255, 224); is white.
Color3.new(135,206,235); is white.

Color3 only goes [0-1] so you'll have to divide your stuff by 255 or stick it through the Valkyrie Design wrapper.

Color3.new(135/255,206/255,235/255);

woof woof
Ad

Answer this question