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!