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

How do I make a script that when I say something in chat something happens like I die?

Asked by 3 years ago
game.Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(Message)
        if Message == "BRUH" or "BRUh" or "BRuh" or "Bruh" or "bruh" or "bRuh" or "brUh" or "bruH" or "bRuH" or "brUH" or "BruH" or "BrUh" or "bRUh" then
           -- I Don't know how to make this kill you
            print("You have said bruh " ..Player.Name)
        end
    end)
end)
0
I wouldn't recomend doing every possibility for capitalization, I would just do: if Message == string.lower("bruh") then OrchidDumpling 16 — 3y

2 answers

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

I may be a little late but this works better than the other answer

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(Message)
        if string.find(string.lower(Message), "bruh") then
            local Character = Player.Character or Player.CharacterAdded:Wait()
            local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
            Humanoid.Health = 0
            print(Player.Name .. " said bruh")
        end
    end)
end)

0
I’ll test it out at 2:00 MAD_DENISDAILY2 137 — 3y
0
Yup, this definitely works better. Thanks for putting out a better answer than mine because I could definitely tell the way I did was very unoptimized. DocGooseYT 110 — 2y
Ad
Log in to vote
0
Answered by 3 years ago

I believe this should work.

game.Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(Message)
        if Message == "BRUH" or "BRUh" or "BRuh" or "Bruh" or "bruh" or "bRuh" or "brUh" or "bruH" or "bRuH" or "brUH" or "BruH" or "BrUh" or "bRUh" then
            Player.Character.Humanoid.Health = 0 -- Sets the player's health to 0 which then kills them
            print("You have said bruh " ..Player.Name)
        end
    end)
end)
0
Looks good to me! MAD_DENISDAILY2 137 — 3y

Answer this question