私はTextBoxに書き込むと、サーバーにあるプレーヤーの名前 が死ぬだろうが、私にこのエラーが出る。TextBoxのインデックスを作成しようとすると、無限の値になる
local screenGui = script.Parent
local textBox = screenGui:FindFirstChild("TextBox", true)
textBox.FocusLost:Connect(function(enterPressed)
--[[This function is called every time the TextBox is "unfocused". A TextBox is "focused" when the player is typing in it, and "unfocused" when they're doing something else.]]
--[[a parameter is passed to this function, "enterPressed". This is true if the player unfocused the TextBox by pressing enter. Another way to unfocus it is by clicking somewhere outside it.]]
--Try to find a player with the name of whatever is in the TextBox
local player = game.Players:FindFirstChild(textBox.Text)
if player then --Check if we found that player
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid") --try to find the humanoid
if humanoid then --check if we found that humanoid
humanoid.Health = 0 --kill the humanoid
end
end
end)
おそらく、textBoxの代わりにTextBoxを使用しますか? –