Help finding a way to delete an frame across all clients

Hi! I’ve been working on a CAD system for quite some time now and i’ve run into a little problem. On my CAD, in the calls I have a “Delete” button, as seen below. Once it is clicked, it is supposed to delete that Frame for all users. However, I can’t find a way to do this as all frames are named the same and if I were to fire all clients and just delete the frame name, it’d delete a random call. I am extremely confused here.

Button UI

Properties

pic

My code ( as of now,) is below. It’s very messy.

Step 1: Delete button clicked.
for i,v in pairs(DispatchMF.Dashboard.Calls.Holder:GetChildren()) do

if not("UIListLayout") then

v.delete.MouseButton1Click:Connect(function()
	
	v.Name = "Delete"
	Functions.RemoveCall()
	
end)

end

end
Step 2: Function receives request
module.RemoveCall = function()

	Events:WaitForChild("DeleteCall"):FireServer()

end
Step 3: Server receives request from function

Whenever I try to make 4 spaces, it just goes on a new line, i’m sorry!

game.ReplicatedStorage.ImprovedCAD.Events.DeleteCall.OnServerEvent:Connect(function(plr)

game.ReplicatedStorage.ImprovedCAD.Events:WaitForChild(“DeleteCall”):FireAllClients()

end)

Step 4: Client Fired
Events.DeleteCall.OnClientEvent:Connect(function()

DispatchMF.Dashboard.Calls.Holder.Delete:Destroy()

end)
--This won't work because only the one in that persons frame was named Delete, not anyone elses. What to do?

Any help is appreciated!

When you’re firing the server, you’re not giving any information on what to delete. Your code seems to send a delete request without knowing which call it’s deleting.

When firing the server, include a param indicating which call is supposed to be deleted, and send that back to all clients.

Hope this was the answer you’re looking for!

How would I say which call is supposed to be deleted though? That’s what I am trying to figure out. They’re all named the same so I can’t just delete the name. :confused:

1 Like

You could change the name of each new call when it comes in, then when performing the delete, send the server the name (call) to delete, then send that back to all the clients to use.

(On mobile sorry it’ll look weird below)

Call comes in (frame named to call name (or use and id if a name can be copied) so all clients have a frame named the call name)
Player deletes call
Before removing, send server call name
Send all clients call name
Remove the frame with that name

1 Like