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

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

Asked by 3 years ago
Edited 3 years ago
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

0
I did include the end statements, so that is not the problem! Just an FYI! bulder251 26 — 3y
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. thecelestialcube 123 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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)
Ad

Answer this question