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

math.randomseed(os.time()) help?

Asked by 8 years ago

So, I've got a script that sends a message in the chat, but when It reaches the 2nd or 5th message, it just loops itself over and over again, but not the thing, that one message...

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.Size18;
        })
    math.randomseed(os.time()) 
        wait(5)
    end

What's meant to happen, is that the server sends a random message to the chat, and then if it's already been said in the loop, it goes to the next message..

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 = {
    Color3.new(255/255,255/255,224/255);
    Color3.new(255/255,0/255,0/255);
    Color3.new(135/255,206/255,235/255);
    Color3.new(255/255,255/255,224/255);
    Color3.new(135/255,206/255,235/255);

}

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.Size18;
        })
        math.randomseed(os.time()) 
        wait(5)
    end

Answer this question