function onButton1Down(mouse) local w = game.Workspace:GetChildren() local i = 1, #w do local (w[i].className == "Camera") or (w[i].className == "Cam" .. game.Players.LocalPlayer.Character.Name) then local w[i].CameraSubject == game.Players.LocalPlayer.Character.Humanoid then local[i].CameraSubject = game.Workspace.SpaceShuttle.SpaceShuttle.Orbiter:findFirstChild("Camera1") local[i].CameraType = "Track" local[i].Name = "Cam" .. game.Players.LocalPlayer.Character.Name local[i].CameraSubject = game.Players.LocalPlayer.Character.Humanoid w[i].CameraType = "Custom" end end end end function onSelected(mouse) mouse.Button1Down:connect(onButton1Down) end script.Parent.Selected:connect(onSelected)
You keep using local which messes up the script. It's supposed to be used for variables such as local a = game.Workspace.Part
. You also forgot the 'if' in the if statement at line 4.
function onButton1Down(mouse) local w = game.Workspace:GetChildren() for i = 1, #w do if w[i].className == "Camera" or w[i].className == "Cam"..game.Players.LocalPlayer.Character.Name then if w[i].CameraSubject == game.Players.LocalPlayer.Character.Humanoid then w[i].CameraSubject = game.Workspace.SpaceShuttle.SpaceShuttle.Orbiter:findFirstChild("Camera1") w[i].CameraType = "Track" w[i].Name = "Cam" .. game.Players.LocalPlayer.Character.Name w[i].CameraSubject = game.Players.LocalPlayer.Character.Humanoid w[i].CameraType = "Custom" end end end end function onSelected(mouse) mouse.Button1Down:connect(onButton1Down) end script.Parent.Selected:connect(onSelected)