How do I force a certain team into first person?

Hello! I am currently trying to make a script where only one team is forced into first person while the rest aren’t. I am a beginner scripter, so this is a beginner script. I do not understand what I’m doing wrong, I’ve tried to figure out many variations of this script to get it working. I’ve looked for tutorials, on the Developer API, even looking at script analysis, but have not found anything! I hope the answer is right in front of me. The current script is below.

P.S. This is NOT for an FPS game.

local player = game.Players.LocalPlayer

player.CameraMaxZoomDistance = 130
player.CameraMinZoomDistance = 0.5

if player and player.TeamColor ("Really red") then
player.CameraMaxZoomDistance = 0.5
player.CameraMinZoomDistance = 0.5

end```
3 Likes

Maybe try:

if player and player.Team == game:GetService("Teams"):FindFirstChild("TeamName") then

Try this

if player.Team == game.Teams["Really red"] then

end
1 Like

Doesn’t work unfortunately. Maybe I have to add some strings to the script.

Doesn’t work either, although I might be missing something. Script analysis isn’t warning me about anything though.

Are you changing the Player team In game or randomly (The game decides what Team is he in)?

I’m changing the player team in game through admin.

2 Likes

Maybe the game checks if the player is on that team at the very start of the game

You need to run a function that will check for the players team and manipulate the camera accordingly when you set their team

for example,

--Set players team here

if plr.Team == "(real)" then
  --do stuff
end
1 Like

To change their view try this:

local cam = workspace.CurrentCamera
local camType = Enum.CameraType.LockFirstPerson
—function to change their view here
1 Like

I see the problem, It would never work.
Try this.

Player:GetPropertyChangedSignal("Team"):Connect(function()
    if player.Team == game.Teams["Really red"] then

end
end)
1 Like

I’m still doing something wrong. This is the current script I’ve made.

local player = game.Players.LocalPlayer
local Player = player

Player:GetPropertyChangedSignal("Team"):Connect(function()
	if player.Team == game.Teams["Really red"] then

player.CameraMaxZoomDistance = 0.5
player.CameraMinZoomDistance = 0.5
	
		
	end
end)

My bad, I see that you are using TeamColor use this instead.

local player = game.Players.LocalPlayer
local Player = player



Player:GetPropertyChangedSignal("TeamColor"):Connect(function()
	if player.TeamColor == game.Teams.Team.TeamColor["Really red"] then

		player.CameraMaxZoomDistance = 0.5
		player.CameraMinZoomDistance = 0.5

	end
end)

Still isn’t working.

https://developer.roblox.com/en-us/api-reference/property/Player/CameraMode

local Enumeration = Enum
local Game = game
local Teams = Game:GetService("Teams")
local RedTeam = Teams.RedTeam

for _, Player in ipairs(RedTeam:GetPlayers()) do
	Player.CameraMode = Enumeration.CameraMode.LockFirstPerson
end

I’ve tested this and it works.
Try this one.

local player = game.Players.LocalPlayer
local Player = player



Player:GetPropertyChangedSignal("TeamColor"):Connect(function()
	if game.Players.LocalPlayer.TeamColor == BrickColor.new("Really red") then


		player.CameraMaxZoomDistance = 0.5
		player.CameraMinZoomDistance = 0.5

	end
end)

Kind of off-topic, but what’s the point of that?

This won’t work As it only updates once when the Player joins.

Oh, I didn’t even Notice that Lol I copied @SentorAmery250 Code and revamped it So I didn’t really notice it.

1 Like

This doesn’t work either, and this time I did not change anything.

I’ve tried it and it works Perfectly for me.
Set the Player TeamColor to this in the Command bar.

game.Players.LocalPlayer.TeamColor = BrickColor.new("Really red") 

Also I’m not sure if your team is “Really Red” or not it might be the issue.