In-game Log System Help

Hello Developers,

I was recently working on a BanSystem, and it works. except for the fact that I wanted local logging with it (basically a new textlabel pops up everytime you ban / kick someone). And I created the code. However it doesn’t work and doesn’t throw any errors in the output.

Script:

local victim = script.Parent.Parent.Victim
local reason = victim.Parent.Reason
local typer = victim.Parent.Type
local template = script.Parent.template
local plr = game.Players.LocalPlayer
local name = plr.Name

local count = 0

victim.Changed:Connect(function()
	
	count += 1
	
	print("Cool")
	
	local newlog = template:Clone()
	newlog.Name = "Log"..count
	newlog.Text = name..": "..typer.Value.." | "..victim.Value
	newlog.Visible = true
	
end)

just a disclaimer: the “Cool” statement does print.

Any Help is Appreciated,
OceanTubez

local victim = script.Parent.Parent.Victim
local reason = victim.Parent.Reason
local typer = victim.Parent.Type
local template = script.Parent.template
local plr = game.Players.LocalPlayer
local name = plr.Name

local count = 0

victim.Changed:Connect(function()
	
	count += 1
	
	print("Cool")
	
	local newlog = template:Clone()
    newlog.Parent = script.Parent -- Or wherever else the frame that holds it is.
	newlog.Name = "Log"..count
	newlog.Text = name..": "..typer.Value.." | "..victim.Value
	newlog.Visible = true
	
end)

I was just about to reply with is.

1 Like

:joy:

Oh the irony, that happens to me all the time

I just fixed it on my own but, thanks for the help LOL!

brain.exe has stopped working

Np, if you could, mark someone as solution! (To assist the SEO)

You should be assigning the parent property last, not directly after the instance is cloned.

local newlog = template:Clone()
newlog.Name = "Log"..count
newlog.Text = name..": "..typer.Value.." | "..victim.Value
newlog.Visible = true
newlog.Parent = script.Parent -- Or wherever else the frame that holds it is.

The same reason applies.