Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this? It wont change cameraSubject

Asked by 3 years ago
local Camera = game.Workspace.CurrentCamera

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(msg)
        if string.sub(msg,1,10) == Prefix.."spectate " then
            Camera.CameraSubject = game.Players:FindFirstChild(string.sub(msg,11)).Character.Humanoid
        end
    end)
end)

2 answers

Log in to vote
0
Answered by 3 years ago

try

Camera.CameraSubject = Enum.CameraSubject. --type what you want the camera subject to be after the . 
0
if this does not work then on line 1 put local Camera = workspace.CurrentCamera MarcTheRubixQb 153 — 3y
0
might be same thing but worth a try roblox studio is like the buggiest thing in the world MarcTheRubixQb 153 — 3y
0
When i try to put enum.camerasubject it doesnt appear Philipceo90 18 — 3y
0
what doesn't appear? Please be more specific MarcTheRubixQb 153 — 3y
View all comments (3 more)
0
CameraSubject Is not a enum Philipceo90 18 — 3y
0
dam your right... But i just tried out your script and it says in the output "index nil with Character" MarcTheRubixQb 153 — 3y
0
never mind i fixed that sorry i dont know MarcTheRubixQb 153 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Cameras can be changed by a local script, NOT a server script. So, if you want to change the CameraSubject, you have to do it in a local script.

Also, you can change the CameraSubject to a player's character model instead of a player's humanoid. Like this:

local cam = workspace.CurrentCamera
cam.CameraSubject = game.Players.LocalPlayer.Character

Answer this question