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
1game.Players.PlayerAdded:Connect(function(Player)
2    Player.Chatted:Connect(function(Message)
3        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
4           -- I Don't know how to make this kill you
5            print("You have said bruh " ..Player.Name)
6        end
7    end)
8end)
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

01local Players = game:GetService("Players")
02 
03Players.PlayerAdded:Connect(function(Player)
04    Player.Chatted:Connect(function(Message)
05        if string.find(string.lower(Message), "bruh") then
06            local Character = Player.Character or Player.CharacterAdded:Wait()
07            local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
08            Humanoid.Health = 0
09            print(Player.Name .. " said bruh")
10        end
11    end)
12end)
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 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

I believe this should work.

1game.Players.PlayerAdded:Connect(function(Player)
2    Player.Chatted:Connect(function(Message)
3        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
4            Player.Character.Humanoid.Health = 0 -- Sets the player's health to 0 which then kills them
5            print("You have said bruh " ..Player.Name)
6        end
7    end)
8end)
0
Looks good to me! MAD_DENISDAILY2 137 — 3y

Answer this question