How to clone a text label into a frame

This post was flagged by the community and is temporarily hidden.

What’s the error? Mind posting your script if you have one?

There is no error, its just that when i say ScriptContext.Error and i require and run a module script then it doesnt work here is the script im reuqiring:

local Admins = {"ThoseNamesAreGood"}
local PlayerCloneThing = game.ReplicatedStorage.PlayerCloneThingy

local CloneLog = {
   Player = function()
   	game.Players.PlayerAdded:Connect(function(Player)
   		for i,v in pairs(Admins) do
   			if Player.Name == v then
   				local NewPlayerCloneThing = PlayerCloneThing:Clone()
   				NewPlayerCloneThing.Parent = Player:WaitForChild("PlayerGui"):WaitForChild("DevConsole").MainConsole.Server.Output
   				NewPlayerCloneThing.Visible = true
   			end
   		end
   	end)
   end
   
   
}


return CloneLog

That works fine its just that this is my main script:

local ScriptContext = game:GetService("ScriptContext")

local Module = require(script.Parent.CloneLog)

Module.Player()

Is that the whole script? It doesn’t look like you’re listening for an error at all. Also your module function is a PlayerAdded listener, so if you happen to join before the function is created then it won’t run.

I’m not sure if it’s the issue as I’m somewhat new with ModuleScripts, but shouldn’t CloneLog be public, and don’t you need a table in the module? module = {} for example.

edit: nvm I didn’t read it properly

The clonelog is the table in the module and no i dont think it has to be public.

1 Like

Sorry here is my script:

local ScriptContext = game:GetService(“ScriptContext”)

local Module = require(script.Parent.CloneLog)
ScriptContext.Error:Connect(function(message, trace, script)
Module.Player()
end)

Unrelated to your error, but i would recommend breaking the loop if the player’s name is equal to v. Another thing you can use is if table.find(Admins, Player.Name) ~= nil then, which can be quicker.