How to Write all Commands as Text in a GUI

hello there, i am trying to make a help command gui but i ran into some issues. I trying to get all the commands from the module script but i can get it to work. Its something like a playerlist but for commands.

Local Script:

local commandList = require(game.ReplicatedStorage.SettingsFolder.Settings)


local template = game.ReplicatedStorage.Template

local list = script.Parent.List


for i, commandList in pairs(commandList.Commands) do
	
	
	local label = template:Clone()
	
	label.Name = i
	
	label.Position = UDim2.new(0.027, 0, i * template.Size.Y.Scale, 0)
	label.Parent = list
end


while wait() do
	
	
	for i, label in pairs(list:GetChildren()) do
		
		
		if commandList.Commands[i] then
			
			
			label.Text = commandList.Commands[i].Name
			
		else
			
			label.Text = ""
		end
	end
end

Module Scipt looks like this:

local Settings = {}

Settings.Commands = {
    Command1 = "!help",
    Command2 = "!kick"
}

return Settings

any help would be good!

Summary

From what I see, your LocalScript is trying to get FacilityCommands from the command ModuleScript, while in your ModuleScript, Commands is the only thing close to FacilityCommands.
I think your problem is that you’re to get a list that doesn’t exist.

the modue script i provided is just an example!

Have you tried debugging like using print()?

Trying printing out the command list in your LocalScript and see you what you get.

ok lemme try that and see!

Summary

This text will be hidden

1 Like

it doesnt work!

Summary

This text will be hidden

What do you mean? Can you tell me what it printed out?

@Forummer can you help me with this!

i got i to work

local commandList = require(game.ReplicatedStorage.SettingsFolder.Settings)


local template = game.ReplicatedStorage.Template

local list = script.Parent.List

for i, comands in pairs(commandList.Commands) do
	print(comands)
	
	local commandText = template:Clone()
	
	commandText.Text = comands
	commandText.Parent = list
	
end

2 Likes