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

Re: Why does the script not switch between the options?

Asked by 6 years ago
DeathMessages = {"Not bad... For an idiot that is...", "Still acting stubborn?", "Do you really want that cake?"}
ChooseOne = DeathMessages[math.random(#DeathMessages)];


game:GetService('Players').PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
           local bc = BrickColor.new("Neon orange")
                game.StarterGui:SetCore("ChatMakeSystemMessage", {
                Text = ChooseOne;
                Font = Enum.Font.Arial;
                Color = bc.Color;
                FontSize = Enum.FontSize.Size96;    
            })
        end)
    end)
end)

so i think i got it right, but it only says in the chat: " Still acting stubborn?" every time i die it doesn't switch to the other ones.

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Hey RealRexTeam,

The reason that it keeps popping up only one message is because the math.random keeps being called only once, you just need to move the ChooseOne variable inside of the function so that it is called every time the function executes. Move it into the .CharacterAdded function so it creates a new text every time the player spawns.

Well, I hope I helped.

~~ KingLoneCat

Ad

Answer this question