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

Players spawn Camera issues?

Asked by
Phixl 11
6 years ago
Edited 6 years ago

Okay so team (Bright Red)players attaches its camera to "Campart1"

team (Bright blue)players does not attach to its destination which is "Campart2" it just stays at where the spawn is at.

Help me have (Bright blue) players go to its destination "Campart2"

for i,v in pairs(game.Players:GetChildren())do
    if v.TeamColor == BrickColor.new("Bright red") then
    local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = game.Workspace:WaitForChild('CamPart1')
cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart1').Position + Vector3.new(0,0,0))
    elseif i.TeamColor == BrickColor.new("Bright blue") then
    local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = game.Workspace:WaitForChild('CamPart2')
cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart2').Position + Vector3.new(0,0,0))
end
end

1 answer

Log in to vote
1
Answered by 6 years ago

You just used "i" instead of "v" in your elseif

for i,v in pairs(game.Players:GetChildren()) do
    if v.TeamColor == BrickColor.new("Bright red") then
     local cam = game.Workspace.CurrentCamera
    cam.CameraType = Enum.CameraType.Scriptable
    cam.CameraSubject = game.Workspace:WaitForChild('CamPart1')
    cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart1').Position + Vector3.new(0,0,0))
    elseif v.TeamColor == BrickColor.new("Bright blue") then
    local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = game.Workspace:WaitForChild('CamPart2')
cam.CFrame = CFrame.new(game.Workspace:WaitForChild('CamPart2').Position + Vector3.new(0,0,0))
end
end
Ad

Answer this question