Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to unlock first person only for one team?

I'm really bad at formatting but I'll give as much information as possible. So, i've been trying to do a game where two teams have first person locked and one has it unlocked: the pilot, since it can't see the outside it has to be in third person, i tried doing some scripts somebody suggested but they didn't work, here are the codes:

since i'll be the only one in the team i tried to do that only I gets third person view but it didn't work

Name = "yes_no123bl"

function onEntered(newPlayer) 
if newPlayer.Name == Name then 
game.StarterPlayer.CameraMaxZoomDistance = 100
end 
end 

game.Players.ChildAdded:connect(onEntered)

here instead i tried to do a loop that check what team you are in and then it changes your zoom distance if you are in pilot team

SpecifiedTeam = "pilot"
SpecifiedColor = BrickColor.new("Storm blue")


while true do
for _, Player in pairs(game.Players:GetChildren()) do
    if Player.Team == SpecifiedTeam and Player.TeamColor == SpecifiedColor then
        Player.CameraMode = Enum.CameraMode.Classic
    else
        Player.CameraMode = Enum.CameraMode.LockFirstPerson
    end
	end
	
	wait(0.1)
	end

any help? ty

1 answer

In your script:

SpecifiedTeam = "pilot"
SpecifiedColor = BrickColor.new("Storm blue")


while true do
for _, Player in pairs(game.Players:GetChildren()) do
    if Player.Team == SpecifiedTeam and Player.TeamColor == SpecifiedColor then
        Player.CameraMode = Enum.CameraMode.Classic
    else
        Player.CameraMode = Enum.CameraMode.LockFirstPerson
    end
    end

    wait(0.1)
    end

You put SpecifiedTeam as a string, not an object. So you will need to do Player.Team.Name, not Player.Team.

1 comment

0

i tried that, but it didn't work out

This discussion is preserved as it was. New answers, comments, and votes are closed.