It does not work for some reason. Here is the full script
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
local table1 = {"CameraPart1", "CameraPart2", "CameraPart3"}
local PlayButton = script.Parent.PlayButton
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace[table1[math.random(1,#table1)]].CFrame
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
local table1 = {"CameraPart1", "CameraPart2", "CameraPart3"}
local PlayButton = script.Parent.PlayButton
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = workspace[table1[math.random(1,#table1)]].CFrame
That might work, I don’t see the reason for the repeat wait until Loop, however, make sure your script is a local script
Yes i am using a local script, however the script still doesn’t work. Also there is nothing in the output.
When i try without match random, it seems to work
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
local table1 = {"CameraPart1", "CameraPart2", "CameraPart3"}
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart1.CFrame -- when i try without match random, it works
Interesting, maybe put it in a variable before you set the CFrame, so:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
local table1 = {"CameraPart1", "CameraPart2", "CameraPart3"}
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
local CamPart = table1[math.random(1, #table1)]
Camera.CFrame = workspace[CamPart].CFrame