I have a group of parts I want to move into position to be in an arena, but when I do the SetPrimaryPartCFrame(), it makes the part I want the PrimaryPart, but the group doesn’t move to it’s CFrame.
–Code to set CFrame
game.Workspace.PurpleLevel:SetPrimaryPartCFrame(game.Workspace.PurpleLevelPrimaryPart.CFrame)
Group’s properites
The Primary Part is something inside of the grouped objects called PrimaryPart. I am trying to change the Primary Part to be PurpleLevelPrimaryPart, and the move the group to the CFrame of PurpleLevelPrimaryPart
local MapLoaded = false
game.ReplicatedStorage.MapChooserServer.OnServerEvent:Connect(function()
local randomNum = math.random(1,3)
print("-------------------------------")
print("Function ran")
print("-------------------------------")
if randomNum == 1 then
print("YellowLevel Selected")
MapLoaded = true
game.Workspace.YellowLevel:SetPrimaryPartCFrame(workspace.YellowLevelPrimaryPart.CFrame)
while MapLoaded == true do
game.ReplicatedStorage.LavaEventServer.OnServerEvent:Connect(function()
MapLoaded = false
end)
wait()
end
game.Workspace.YellowLevel:SetPrimaryPartCFrame(workspace.YellowLevelUnloaded.CFrame)
else if randomNum == 2 then
print("BlueLevel Selected")
MapLoaded = true
game.Workspace.BlueLevel:SetPrimaryPartCFrame(workspace.BlueLevelPrimaryPart.CFrame)
while MapLoaded == true do
game.ReplicatedStorage.LavaEventServer.OnServerEvent:Connect(function()
MapLoaded = false
end)
wait()
end
game.Workspace.BlueLevel:SetPrimaryPartCFrame(workspace.BlueLevelUnloaded.CFrame)
else if randomNum == 3 then
print("PurpleLevel Selected")
MapLoaded = true
game.Workspace.PurpleLevel:SetPrimaryPartCFrame(game.Workspace.PurpleLevelPrimaryPart.CFrame)
while MapLoaded == true do
game.ReplicatedStorage.LavaEventServer.OnServerEvent:Connect(function()
MapLoaded = false
end)
wait()
end
game.Workspace.PurpleLevel:SetPrimaryPartCFrame(game.workspace.PurpleUnloaded.CFrame)
end
end
end
end)
wait()