Hey there, I have a script that clones a model from ReplicatedStorage and parents it to workspace using UIS and Remote Events.
I also have another script that should remove these cloned models from the workspace. I am trying to do this by using GetChildren to get the children of workspace and then using a for loop to check if there are any objects named "Model", if there is then these models would be destroyed.
Yet, nothing is happening?
What would solve this issue? Any help would be greatly appreicated!
Here is the code:
local rs = game:GetService("ReplicatedStorage")
local event2 = rs:WaitForChild("RemoteEvent2")
local c = game.Workspace:GetChildren()
local function remove()
for i = 1, #c do
if c[i].Name == "Model" then
c:Destroy()
end
end
event2.OnServerEvent:Connect(remove)

3 comments
Try publishing your game
Try using workspace:GetDescendants() instead of workspace:GetChildren().
I have, still nothing :/