So I’m working on this small project where when you join it makes a dummy called (player’s name)'s Clone and for some reason the ‘clone’ won’t spawn? I’m working on making the dummy have the same appearance as the player
Code:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local clone = game.ServerStorage.Dummy:Clone(game.Workspace)
clone.Name = plr.Name.."'s Clone"
repeat
wait()
clone.Humanoid:MoveTo(char:WaitForChild("HumanoidRootPart").Position)
until game.Players.PlayerRemoving:Connect(function(plr)
if game.Workspace:FindFirstChild(plr.Name.."'s Clone") then
game.Workspace[plr.Name.."'s Clone"]:Destroy()
end
end)
end)
end)
local players = game:GetService("Players")
local serverStorage = game:GetService("ServerStorage")
local dummy = serverStorage:WaitForChild("Dummy")
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local clone = dummy:Clone()
clone.Parent = workspace
clone.Name = plr.Name.."'s Clone"
repeat
wait()
clone:WaitFirstChild("Humanoid"):MoveTo(char:WaitForChild("HumanoidRootPart").Position)
until players.PlayerRemoving:Connect(function(plr)
if workspace:FindFirstChild(plr.Name.."'s Clone") then
workspace[plr.Name.."'s Clone"]:Destroy()
end
end)
end)
end)