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

Why does the script not switch between the two options?

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 = "Not bad... For an idiot that is..." or "Here goes another life..." ;
				Font = Enum.Font.Arial;
				Color = bc.Color;
				FontSize = Enum.FontSize.Size96;	
			})
        end)
    end)
end)

When I input the value of text, i expected the value to change everytime i die. should i use math.random?

1 answer

✓ Accepted answer

Hey RealRexTeam,

If you want to use a different string you're going to need to make a table of strings and then select one from the table randomly. Like this:

local strings = {"Whatever", "Ok, man..."}

local string = strings[math.random(#strings)];

print(string);

The reason yours doesn't work is because the or operator is like a ternary operator in which if the first option doesn't work it goes for the second one, it's useful for :FindFirstChild(), so if it couldn't find the first object, it would go for the second one.

###Well, I hope i helped and have a nice day.

~~ KingLoneCat

2 comments

0

but what would i put as the value of Text? Text = (string); ?

0

Just put the string as the text. Text = string;

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