Issue with CFrames (and others)

Good evening all!

Today, I attempted to make a system which moves all of my four dummies up depending on the input. I know, this is more complicated then it should be but I tried to challenge myself by using a variety of different features. Whenever I run my code, an error such as: “CFrame is not a valid member of Model “Workspace.Dummies.2” - Server - DummyMoverModule:13” I’m utilising a normal dummy with it’s PrimaryPart set as the HumanoidRoot Part. Any help is MUCH appreciated!

-- My ModuleScript
local DummyMoverModule = {}


DummyMoverModule.VerticalMoveHeight = 50
DummyMoverModule.HorizontalMoveHeight = 10



function DummyMoverModule:MoveDummiesUp(dummy, Type)
	if Type == "Vertical" then
		local NextPosition = dummy.HumanoidRootPart.CFrame * CFrame.new(0, DummyMoverModule.VerticalMoveHeight, 0)
		dummy.CFrame = NextPosition
	elseif Type == "Horizontal" then
		local NextPosition = dummy.HumanoidRootPart.PrimaryPart.CFrame * CFrame.new(DummyMoverModule.HorizontalMoveHeight, 0, 0)
		dummy.CFrame = NextPosition
	end
	
end

return DummyMoverModule
 -- This is my server script
local Dummies = game.Workspace.Dummies:GetChildren() -- Instance "Dummies" is a folder with all dummies inside
local DummyMoverModule = require(game.ServerStorage.DummyMoverModule)


for i, dummy in pairs(Dummies) do 
	task.wait(2)
	DummyMoverModule:MoveDummiesUp(dummy, "Vertical")
end

Thanks for helping out!

1 Like

you forgot the HumanoidRootPart

dummy.HumanoidRootPart.CFrame = NextPosition

Hi, thanks for your reply. It is now working, however strangely enough the HRP is the only object that moves, but the actual dummy does not move?

You shouldn’t be directly setting the PrimaryPart CFrame, you should be using PivotTo

1 Like

Where would I integrate PivotTo()?

Just replace the lines where your setting the CFrame and instead do Dummy:PivotTo(CFRAME)

I’m assuming in this context it would be dummy:PivotTo(NewPosition)

bro yes

Thanks for that, apologies if I wasted your time. It works now, have a fantastic night and I hope you have a good life. : )

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.