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```
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)
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
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)