I was creating a ban GUI which is a remote event, so when you press the GUI it fires an event that gets the text of a Textbox, but in the output it says this.
Infinite yield possible on 'Players:WaitForChild(“something”)
something is the original text, even if i type something else it still thinks the text its “something.”
We can’t really help if we don’t have the code you’re using, could you send us both the code relating to the textbox and the code relating to the remotevent?
local REvent = script.RemoteEvent
script.Parent.Activated:Connect(function()
REvent:FireServer()
end)
code for the script:
local textbox = script.Parent.Parent
local Input = textbox.Parent.TextBox
script.Parent.RemoteEvent.OnServerEvent:Connect(function()
local player = game.Players:WaitForChild(Input.Text)
if player then
player:Kick()
end
end)
you are already setting up the variable instead you should do that:
local REvent = script.RemoteEvent
local TextBox= -----your text box here
script.Parent.Activated:Connect(function()
REvent:FireServer(TextBox.Text)
end)
server script:
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr, text)
if game.Players:FindFirstChild(text) then
local player = game.Players:FindFirstChild(text)
player:Kick()
end
end)
You’re only firing the server when it’s activated, not changed to make it when it’s changed do this:
local REvent = script.RemoteEvent
local normText = script.Parent.Text
script.Parent.InputChanged:Connect(function()
if script.Parent.Text ~= tostring(normText) then
REvent:FireServer()
end
end)
Still, I would suggest using @MrchipsMa 's solution though