How load CFrame position from Module?

Hello! I’m want make shop with manipulation camera, and to not make a lots copies of shops i wanted make 1 with metod destroy item and replace him on other with button, but i have error

local RS = game:GetService("ReplicatedStorage")
local PosModule = require(RS.Modules.ListOfPositionShop)
--script
local ValueITEM = player.PlayerGui.Switch.Shop.Frame.ITEM
--script
local ShelfesITEM = RS.Items:FindFirstChild("Shelfes"):Clone()
--script
ShelfesITEM.CFrame = CFrame.new(PosModule.CFRAMEPOS[ValueITEM.Value])
-script

In module:

local module = {}
module.CFRAMEPOS = {
	["Shelfes"] = {99.95, 8.032, -40.263},
	
}

return module

How fix and make CFrame pos to workers?

When you set module.CFRAMEPOS.Shelfes (the plural for shelf is shelves, just a heads up) you create an array-table of 3 numbers.

You instead should be doing the following in the module…

local module = {}

-- I also recommend renaming CFRAMEPOS to CFramePositions for readability. You will
-- need to update this reference elsewhere too if you do decide to change the name.
module.CFRAMEPOS = {
    -- You don't have to use ["string"], that's typically only useful for using
    -- reserved words or variables. But it's up to you.
    Shelves = Vector3.new(99.95, 8.032, -40.263),
}

return module

You can obviously remove the comments once you’ve read them.

1 Like
CFrame.new(unpack(module.CFRAMEPOS.Shelfes))

Or you could just put a vector3 in the dictionary instead.

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