Hi guys! What is the correct way to use CFrame in a model? I've searched different forums and they talk about Primary Part and in the SetPrimaryPartCFrame code. But the problem is that when you kill an animal, the meat falls off it. But no matter how I tried to do it, I failed. Could you please help me with this?
local Model = script.Parent local Humanoid = Model.Humanoid local Torso = Model.Torso local WalkAnim = Humanoid:LoadAnimation(Humanoid.WalkAnim) local Meat = game.Workspace.Mechanics.Food.Meat local meatSet = game.Workspace.Mechanics.Food.Meat.Meat local drop = script.Parent.HumanoidRootPart.CFrame Humanoid.Died:Connect(function(plr) Meat:SetPrimaryPartCFrame(meatSet.CFrame * CFrame.new(drop)) task.wait(3) script.Parent:ClearAllChildren() end) while true do wait(math.random(1,6)) WalkAnim:Play() Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-16, 16), 0, math.random(-16, 16))) Humanoid.MoveToFinished:Connect(function() WalkAnim:Stop() end) end
Meat:SetPrimaryPartCFrame(meatSet.CFrame * CFrame.new(drop))
from SetPrimaryPartCFrame, you can directly go to drop. and because its already a cframe value, you don't need to use cframe.new.
change the line above to Meat:SetPrimaryPartCFrame(drop) and it should work