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

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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

1
If it's solved, you could probably put something like "[CLOSED]" in the title to mark it as solved User#30567 0 — 3y
Ad

Answer this question