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 4 years ago
Edited 4 years ago
1TextButton.Changed:Connect(function()
2    if TextButton.Text == ("I like cheese and milk") then
3        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?

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

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

1 answer

Log in to vote
0
Answered by 4 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.

1TextButton.Text.Changed:Connect(function()
2    if TextButton.Text == ("I like cheese and milk") then
3        TextBox.Text = ("I like yur cut g")
4    end
5end)
Ad

Answer this question