UI Frame not cloning / Positioning

Hi! I am attempting to make a police CAD system. I ran into a slight problem making this. I am trying to make a button where when the Dispatcher clicks it, it takes the TextBox text and sends it to a Server Event which would then fire all clients. ( I don’t know if a client can fire all clients? ) In doing so, I tried to then get the clients to clone a holder and then change the text. I didn’t position it because I assumed the UIListLayout would position it itself. My code is as follows…

–The below is a LocalScript.

--Dispatch

DispatchScreen.NewCall.NewCall.NewCall.MouseButton1Click:Connect(function()

local ctype = DispatchScreen.NewCall.NewCall.type.Text
local cdesc = DispatchScreen.NewCall.NewCall.desc.Text


game.ReplicatedStorage.CaDSystem.Events.NewCallEvent:FireServer(ctype, cdesc)

end)


-- Client 
 game.ReplicatedStorage.CaDSystem.Events.NewCallEvent.OnClientEvent:Connect(function(ctype, cdesc)

local newcallframe = PoliceScreen.CallInfo.CallInfo.ScrollingFrame.Call:Clone()
newcallframe.type.Text = ctype
newcallframe.desc.Text = cdesc

local newcallframe2 = DispatchScreen.CallInfo.CallInfo.ScrollingFrame.Call:Clone()
newcallframe2.type.Text = ctype
newcallframe2.desc.Text = cdesc

end)

Below is the ServerScript which would fire all clients…

game.ReplicatedStorage.CaDSystem.Events.NewCallEvent.OnServerEvent:Connect(function(plr, ctype, cdesc)

 game.ReplicatedStorage.CaDSystem.Events.NewCallEvent:FireAllClients(ctype, cdesc)

end)

well, you aren’t parenting the frame, that’s your issue

Ah, I thought when I clone it, it stays in the same place I cloned. I will try this and mark you right if it works. :slight_smile:

It seems that didn’t work. Thank you for your response though!

so the parenting isn’t working? weird.

Yeah, it might be because I am parenting wrong but I am not sure…

	local newcallframe2 = DispatchScreen.CallInfo.CallInfo.ScrollingFrame.Call:Clone()
newcallframe2.Parent = PoliceScreen.CallInfo.CallInfo.ScrollingFrame
newcallframe2.type.Text = ctype
newcallframe2.desc.Text = cdesc

yeah, you are parenting it into the wrong one, the current one is DispatchScreen, but the new one is PoliceScreen, not sure if thats intentional or anything

Yeah I just grabbed one part of the code since that’s the one I am checking this in. I also found out the problem is a part of the positioning because the prints get printed when cloned, so I am assuming the UIListLayout isn’t working properly :confused:

Turns out the problem was because for some reason making the clone a variable it wouldn’t work. I’ve found a workaround!

And what exactly was that workaround you found?

I just took the long way around, removed the local from it, found it by just searching for the name, position it manually and such :confused: