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

Why does every text work for this IF statement? [CLOSED]

I tried to make a cool text randomizer and there is this one text that's special which tps you inside of a tube. However almost all of the text tp you inside of the tube even though I specified only one? Please help.

local cooldown = false
local NC = script.parent.parent.parent.NeonCircle
local NC2 = script.parent.parent.parent.NeonCircle2


script.parent.ProximityPrompt.Triggered:Connect(function(player)
	if cooldown == false then
		local Text = {
			"HAHA JOKES ON U THE BUTTON PUSHED U!",
			"NO U!",
			"HAHA JOKES ON U THE BUTTON KILLED YOU!",
			"LOL UNO REVERSE",
			"WHAT A WIMP YOU'RE NOT STRONG ENOUGH TO PUSH ME",
			"NERD THAT SUCKS AT PUSHING BUTTONS SPOTTED",
			player.Name.."? MORE LIKE YOUR TRASH!",
			"U GOT NUTHING ON DIS BUTTON",
			"HAHA THE GUY GOT TELEPORTED, WHAT A LOSERRRR"
		}
		local RandomText = Text[math.random(#Text)]
		if RandomText == "HAHA JOKES ON U THE BUTTON KILLED YOU!" then
			script.parent.ProximityPrompt.ObjectText = RandomText
			player.Character.Humanoid.Health = 0
			cooldown = true
			wait(4)
			script.parent.ProximityPrompt.ObjectText = "DON'T PUSH THE BUTTON!"
			wait(2)
			cooldown = false
			return
		elseif "HAHA THE GUY GOT TELEPORTED, WHAT A LOSERRRR" then
			player.Character.HumanoidRootPart.CFrame = NC2.TP.CFrame or NC.TP.CFrame
		else
			script.parent.ProximityPrompt.ObjectText = RandomText
			player.Character.Humanoid.Sit = true
			cooldown = true
			wait(4)
			script.parent.ProximityPrompt.ObjectText = "DON'T PUSH THE BUTTON!"
			wait(2)
			cooldown = false
		end
	end
end)

1 answer

Never mind I'm just dumb, I forgot to put "RandomText ==" before the text.

1 comment

1

If it's solved, you could probably put something like "[CLOSED]" in the title to mark it as solved

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