I'm making a round system with a random map selector. I keep getting this error: "CFrame expected, got Vector3", I have tried using CFrame and it gives practically the same error: "Vector3 expected, got CFrame", Heres my code:
local MapsFolder = game.Lighting.Maps local Maps = MapsFolder:GetChildren() local IntermissionTime = script.IntermissionTime local Message = Instance.new("Hint")
while true do
local ChosenMap = Maps[math.random(1, #Maps)] local MapClone = ChosenMap:Clone() wait(IntermissionTime.Value) Message.Parent = game.Workspace Message.Text = "Map Chosen: "..ChosenMap.Name wait(5) if _G.InsideBossBattle == true then -- The bool value here becomes true when a player beats the obby Message.Parent = game.Lighting return end if ChosenMap.Name == "FloorIsLava" then local Target = Vector3.new(-336.78, 11.12, 128.1) for i, player in ipairs(game.Players:GetChildren()) do -- Referencing all the players if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.CFrame = Target + Vector3.new(0, i * 5, 0) -- Teleporting all the players end end end if ChosenMap.Name == "Temple" then local Target = Vector3.new(83.9, 29.3, 142.6) for i, player in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.CFrame = Target + Vector3.new(0, i * 5, 0) end end end if ChosenMap.Name == "Nature" then local Target = Vector3.new(53.86, 44.4, 512.42) for i, player in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.CFrame = Target + Vector3.new(0, i * 5, 0) end end end MapClone.Parent = game.Workspace MapClone:MakeJoints() if _G.InsideBossBattle == true then MapClone:Destroy() end
end
change
Target + Vector3.new(0, i * 5, 0)
to
CFrame.new(Target + Vector3.new(0, i * 5, 0))
idk if this works, but if it works, then have a great day! stay safe.
change
Target + Vector3.new(0, i * 5, 0)
to
CFrame.new(Target + Vector3.new(0, i * 5, 0))
idk if this works, but if it works, then have a great day! stay safe.