I want to know how to know if clone is already in the workspace and if so it deletes the clone and replaces it with the new one
script:
local rep = game:GetService("ReplicatedStorage")
local folder = rep:WaitForChild("Folder")
local rem = folder:WaitForChild("RemoteEvent")
local ghost = folder:WaitForChild("ghost")
rem.OnServerEvent:Connect(function(plr)
local message = plr.Name.." Ghost"
local char = plr.Character or plr.CharacterAdded:Wait()
local humrp = char:WaitForChild("HumanoidRootPart")
local clone1 = ghost:Clone()
local clone2 = ghost:Clone()
local hum1 = clone1.Humanoid
hum1.DisplayName = message
local humrp1 = clone1.HumanoidRootPart
local humrp2 = clone2.HumanoidRootPart
clone1.Parent = workspace
clone2.Parent = workspace
while task.wait() do
humrp1.CFrame = humrp.CFrame * CFrame.new(6,0,0)
humrp2.CFrame = humrp.CFrame * CFrame.new(-6,0,0)
print("OK")
end
end)