Hello, I would like to know how I can make the player when he dies a copy is created on the ground and that the player after a few seconds appears on his body, how is this possible?
starter character script:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
local body = game.ReplicatedStorage.Body:Clone()
body.Parent = workspace
body:SetPrimaryPartCFrame(character:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(0,90,0))
end)
end)
end)
Try using HumanoidDescription System so when u clone a body u apllied the HumanoidDescription by the player which died which mean u add its accesseory shirt and everything he wears
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local dummy = workspace:FindFirstChild("_"..player.Name)
if dummy then
game:GetService("RunService").Heartbeat:Wait()
character:SetPrimaryPartCFrame(dummy.PrimaryPart.CFrame)
dummy:Destroy()
end
character.Humanoid.Died:Connect(function()
local description = character.Humanoid.HumanoidDescription
local new = script.Dummy:Clone() --Change this to be the dummy character you are cloning.
new:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0, 1000, 0)))
new.Name = "_"..player.Name
new.Humanoid.DisplayName = player.Name
new.Parent = workspace
new.Humanoid:ApplyDescription(description)
new:SetPrimaryPartCFrame(character.PrimaryPart.CFrame)
end)
end)
end)
It doesn’t work, I need the dummy to appear in the position that the player died
script
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local dummy = workspace:FindFirstChild("_"..player.Name)
if dummy then
game:GetService("RunService").Heartbeat:Wait()
character:SetPrimaryPartCFrame(dummy.PrimaryPart.CFrame)
dummy:Destroy()
end
character.Humanoid.Died:Connect(function()
local description = character.Humanoid.HumanoidDescription
local new = game.ReplicatedStorage.THISDUMMY:Clone() --Change this to be the dummy character you are cloning.
new:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0, 1000, 0)))
new.Name = "_"..player.Name
new.Humanoid.DisplayName = player.Name
new.Parent = workspace
new.Humanoid:ApplyDescription(description)
new:SetPrimaryPartCFrame(character.PrimaryPart.CFrame)
end)
end)
end)