I’m trying to send this CFrame value from a ServerScript to a ModuleScript function I have in ServerStorage.
--in ServerScript, calling the function in the ModuleScript
local cf = anothercf:ToWorldSpace(CFrame.new(0,0,-4.5))
local returndata = module:MakePart(cf)
However, the ModuleScript throws an error when I try to use the value to set the CFrame of a part, saying “(CFrame expected, got table)”
--in ModuleScript
function module.MakePart(cf)
local part = Instance.new("Part", workspace)
part.Name = "Box"
part.Size = Vector3.new(9,9,9)
part.Locked = true
part.Anchored = true
part.CanCollide = false
part.Transparency = 0.5
part.CFrame = cf --throws error at this line
end
I tried using the CFrame value in the same ServerScript and it worked.
local cf = anothercf:ToWorldSpace(CFrame.new(0,0,-4.5))
local testpart = Instance.new("Part", workspace)
testpart.CFrame = cf
local returndata = module:MakePart(cf)
The part was created and positioned at that CFrame.
So I’m thinking it’s some behaviour of ModuleScripts that I don’t understand.