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

How to make a TextButton with certain text kill the player who entered that text?

TextButton.Changed:Connect(function()
	if TextButton.Text == ("I like cheese and milk") then
		TextBox.Text = ("I like yur cut g") 

Within these lines I want to kill the player within the if statement and after the then. I tried this; but it did not work? The player did not die. Any thoughts?

local humanoidcheck = game:FindFirstChild("Humanoid")
if humanoidcheck ~= nil then
humanoidcheck.Health = 0

2 comments

0

I did include the end statements, so that is not the problem! Just an FYI!

0

I assume that this is in a localscript, so when you kill the player it only kills the player on the player's device, and not the server.

1 answer

You need to put the value you want to be changed for .Changed to work, in this case, it would be TextButton.Text.

TextButton.Text.Changed:Connect(function()
    if TextButton.Text == ("I like cheese and milk") then
        TextBox.Text = ("I like yur cut g") 
    end
end)

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