When you type in a command box its suppost to tween a gui's size upwards and show any commands that are found but it will not tween the gui at all and it prints no errors.

Script:

--/ Variables
local UI = script.Parent
local Assets = UI:WaitForChild("Assets")
local MatchedCommands = UI:WaitForChild("MatchedCommands")
local CommandBox = UI:WaitForChild("CommandBox")
local Command = Assets:WaitForChild("Command")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage:WaitForChild("Events")
local Event = Events:WaitForChild("Event")
local Modules = ReplicatedStorage:WaitForChild("Modules")
local Commands = require(Modules:WaitForChild("Commands"))

local MatchedCommands_Open = UDim2.new(0.85, 0,0.43, 0)
local MatchedCommands_Close = UDim2.new(1, 0,0.43, 0)

--/ Functions
function CheckCommand(text)
	local FoundCommands = {}
	for i,v in pairs(Commands) do
		local Cmd = string.lower(v)
		local textl = string.lower(text)
		if string.sub(Cmd,1,#textl) == textl then
			table.insert(FoundCommands, v)
		end
	end
	if #FoundCommands == 0 then
		return {false, {}}
	elseif #FoundCommands > 0 then
		return {true, FoundCommands}
	end
end

function clearFoundCommands()
	for i,v in pairs(MatchedCommands:GetChildren()) do
		if v:IsA("TextLabel") then
			local AbsSize = MatchedCommands.AbsoluteSize -- Here
			local CmdSize = v.AbsoluteSize
			local NewY = (AbsSize+CmdSize)
			local RealSize = UDim2.new(AbsSize.x,0,NewY,0)
			MatchedCommands:TweenSize(RealSize, "Out","Linear",0.5,true)
			v:Destroy()
		end
	end
end

function AddFoundCommands(Commands)
	for i,v in pairs(Commands) do
		local CommandT = Command:Clone()
		CommandT.Name = v
		CommandT.Text = v
		CommandT.Parent = MatchedCommands
		CommandT.Visible = true
		local AbsSize = MatchedCommands.AbsoluteSize -- And Here
		local CmdSize = CommandT.AbsoluteSize
		local NewY = (AbsSize-CmdSize)
		local RealSize = UDim2.new(AbsSize.x,0,NewY,0)
		MatchedCommands:TweenSize(RealSize, "Out","Linear",0.5,true)
	end
end

function TweenMatchedCommands(state)
	if state == true then
		MatchedCommands:TweenPosition(MatchedCommands_Open, "Out", "Linear", 0.5, true)
	elseif state == false then
		MatchedCommands:TweenPosition(MatchedCommands_Close, "Out", "Linear",0.5, true)
	end
end

CommandBox.Focused:Connect(function()
	--TweenMatchedCommands(true)
end)

CommandBox.FocusLost:Connect(function()
	--TweenMatchedCommands(false)
	clearFoundCommands()
	local command = tostring(CommandBox.Text)
	local isCommand = CheckCommand(command)
	Event:FireServer(command)
	CommandBox.Text = ""
end)

CommandBox.Changed:Connect(function()
	if CommandBox.Text == "" or CommandBox.Text == nil then clearFoundCommands() return end
	local text = tostring(CommandBox.Text)
	local IsCommand = CheckCommand(text)
	if IsCommand[1] == true then
		local FoundCommands = IsCommand[2]
		clearFoundCommands()
		AddFoundCommands(FoundCommands)
	end
end)

1 comment

0

I don't know why, but all my chat commands recently broke. I think ROBLOX updated something, I don't know, I think there is still a new way, just I have not had the energy to find it.