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

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

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)

1 comment

0

I wouldn't recomend doing every possibility for capitalization, I would just do: if Message == string.lower("bruh") then

2 answers

✓ Accepted answer

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)

2 comments

0

I’ll test it out at 2:00

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.

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)

1 comment

0

Looks good to me!

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