Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

My Model DeadBody wont spawn in the right place?

Asked by
neoG457 315 Moderation Voter
10 years ago
01DedScript = game.Workspace.Human.DeadBody
02ded = game.ReplicatedStorage.Dead:Clone()
03chest = game.Workspace.Human.Torso
04Heart = Instance.new("Part")
05 
06local w = Instance.new('Weld')
07    w.Part0 = Heart
08    w.Part1 = chest
09    w.C0 = CFrame.new(0, 0, 0)*CFrame.Angles(0 , 0, 0)
10    w.Parent = chest
11 
12if DedScript.Parent.Humanoid.Health<1 then
13 
14    Heart.Parent = workspace
15    Heart.Transparency = 0
View all 45 lines...

I have an NPC called Human in workspace. When it dies the part name "Heart" should spawn at its torso that I've named "Chest". Then a Model Dead Body that I've put in Replicated Storage should be cloned into workspace (Ive named the clone "ded") and placed where the Heart is. However it doesnt seem to work. It gives me this error on line 40

"Workspace.Human.Dead:43: bad argument #1 to '?' (CFrame expected, got userdata) Script 'Workspace.Human.DeadBody', Line 40 Stack End"

DeadBody is the name of the script. Please help me with this.

0
Is ded in workspace? woodengop 1134 — 10y
0
Yes neoG457 315 — 10y

1 answer

Log in to vote
3
Answered by 10 years ago

Your error is on line 40, heart is a object not a CFrame. All you need to do is change it to this

1ded:SetPrimaryPartCFrame(Heart.CFrame * CFrame.new(0, 0, 0)) --see now we are getting the CFrame of the heart
0
Thanks. neoG457 315 — 10y
Ad

Answer this question