local textbox = game.StarterGui.ScreenGui.TextBox local changed = textbox.Changed
changed:Connect(function() textbox.Text = ("die") if then script.Parent:Destroy() end
end)
GetPropertyChangedSignal fires if the property inside it changes
string.lower makes sure if player inputs ‘Die’, ‘diE’, or ‘die’, it all works.
Set local player’s hp to 0 if text passed the condition
local textbox = game.Players.LocalPlayer.PlayerGui:WaitForChild('ScreenGui').TextBox textbox:GetPropertyChangedSignal('Text'):Connect(function() if string.lower(textbox.Text) == 'die' then game.Players.LocalPlayer.Character.Humanoid.Health = 0 end end)
Maybe, it should be an event, like this
if textbox.Text == "Die" then local plr = game.Players.LocalPlayer.Character plr.Humanoid.Health = 0