Basically, I have this script which is in a textbox that when pressed enter it would shutdown the server with an optional reason, but for some weird reason I'm getting a number instead of words and I have tried to found out the reason but to no avail i could not find the reason. Here is my script:
function Run(args)
script.Parent.Parent.exe.SE:FireServer("",args)
end
game:GetService("UserInputService").InputBegan:Connect(function(e,gpe)
if e.UserInputType == Enum.UserInputType.Keyboard then
if e.KeyCode == Enum.KeyCode.Return then
local text = script.Parent.Text
local txt = script.Parent
if string.find(text:sub(1, 8), "shutdown") then
local reason = "Game Shutdown! Reason: No Reason Given."
if string.find(text:sub(10, #text), ".+") then
print(string.find(text:sub(10, #text), ".+")) -- Prints numbers instead of a string or anything else
reason = "Game Shutdown! Reason: " .. string.find(text:sub(10, #text), ".+")
end
for _,p in pairs(game:GetService("Players"):GetChildren()) do
Run("game:GetService('Players').".. p.Name .. ":Kick('" .. reason .. "')")
end
txt.Text = ''
end
end
end
end)
I have used the same method of getting the words before for other command but just for this command I'm getting this weird error, can someone explain to me what is going on?
Here is what the print outputs when I type lol btw: 1 3

2 comments
What's stopping you from doing text:sub(10, #text) instead of string.find(text:sub(10, #text), ".+")
oh... uh i completely missed that ill give it a try.