PipeSader
(PipeSader)
January 31, 2021, 5:53pm
#1
Hi guys, I would like to make ‘thisdummy’ appear in the workspace at the player position, how do I do it? What am I doing wrong in my code?
script:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function(plr)
local humanoid = script.Parent.Humanoid
local desc = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
humanoid:ApplyDescription(desc)
local dm = game.ReplicatedStorage.THISDUMMY:Clone()
dm.Parent = workspace
end)
end)
end)
2 Likes
Intencidy
(smelvin)
January 31, 2021, 5:57pm
#2
I think you need another string saying:
dm.HumanoidRootPart.CFrame = character.HumanoidRootPart.CFrame
PipeSader
(PipeSader)
January 31, 2021, 5:58pm
#3
like this?
local humanoid = script.Parent.Humanoid
local desc = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
humanoid:ApplyDescription(desc)
local dm = game.ReplicatedStorage.THISDUMMY:Clone()
dm.Parent = workspace
dm.HumanoidRootPart.CFrame = character.HumanoidRootPart.CFrame
2 Likes
Intencidy
(smelvin)
January 31, 2021, 5:59pm
#4
Yes because it tells the script to position the dummy where the player’s character is.
1 Like
PipeSader
(PipeSader)
January 31, 2021, 6:03pm
#5
It did not work, when I die it is not cloned and the dummy does not appear in my position or in any part of the workspace
Intencidy
(smelvin)
January 31, 2021, 6:06pm
#6
Are there any errors in the output?
PipeSader
(PipeSader)
January 31, 2021, 6:10pm
#7
No errors in console… I put a print and it is not shown in console either
script:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function(plr)
local humanoid = script.Parent.Humanoid
local desc = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
humanoid:ApplyDescription(desc)
local dm = game.ReplicatedStorage.THISDUMMY:Clone()
dm.Parent = workspace
dm.HumanoidRootPart.CFrame = character.HumanoidRootPart.CFrame
print("cloned!!")
end)
end)
end)
1 Like
Intencidy
(smelvin)
January 31, 2021, 6:28pm
#8
Ok so after a bit of testing I fixed the problem. I basically moved the script into the ServerScriptService and made a few changes to it. Here’s what it looks like:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function(plr)
local dm = game:GetService("ReplicatedStorage"):FindFirstChild("THISDUMMY"):Clone()
print("cloned!!")
dm.Parent = workspace
dm:FindFirstChild("HumanoidRootPart").CFrame = character.HumanoidRootPart.CFrame
end)
end)
end)
This works for me.
1 Like
PipeSader
(PipeSader)
January 31, 2021, 6:37pm
#9
Works!
but how can i add this to the script?
local humanoid = dummyhumanoidhere
local desc = game.Players:GetHumanoidDescriptionFromUserId(plr.UserId)
humanoid:ApplyDescription(desc)
Intencidy
(smelvin)
January 31, 2021, 6:52pm
#10
Try this:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function(plr)
local dm = game:GetService("ReplicatedStorage"):FindFirstChild("THISDUMMY"):Clone()
print("cloned!!")
dm.Parent = workspace
dm:FindFirstChild("HumanoidRootPart").CFrame = character.HumanoidRootPart.CFrame
local humanoid = dm.Humanoid
local desc = game.Players:GetHumanoidDescriptionFromUserId(player.UserId)
humanoid:ApplyDescription(desc)
end)
end)
end)
1 Like
PipeSader
(PipeSader)
January 31, 2021, 7:03pm
#11
1 Like