Why this simple code not working

the code

game:GetService("ReplicatedStorage").ChildRemoved:Connect(function(obj)
	print(obj.Name)
end)

ChilldAdded is working but ChildRemoved is not working

1 Like

It does print obj and obj.Name for me. Are you sure you’re not getting error or something?

1 Like

there is no error but it doesnt print obj’s name

1 Like

It’s either that the instances got destroyed before the script loaded or that you’re destroyed things from the client and you connected the event on the server.

2 Likes

Are those local script and not in normal script?

1 Like

Nevermind. It might not been related on what type of script you are using.
Perhaps, it just like what @msix29 said.

1 Like

its normal script that in the server script service

1 Like

i destoryed instance myself in explorer

1 Like

When you destroy stuff on client side, it won’t check on server side.
(Most likely your problem)

Instead, click this to switch to server side when you Play-Test
image

image

1 Like

That destroyed it in the client (most probably) so looks like my assumption is correct. @LuaCoold told you how to switch between server and client so I don’t think I need to do so anymore.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.