Although, if you absolutely insist on an constant loop that does it, just add this to the very bottom:
while wait() do
myTeamChanged()
end
Although, if you absolutely insist on an constant loop that does it, just add this to the very bottom:
while wait() do
myTeamChanged()
end
Add --
before all 3 of those lines, it should appear grey like the first line if you did it properly. That will make the code be ignored, and it will not run.
Xep#7346
Edit: I don’t know how I missed the other 4 references, but I’ll blame my tiredness.
All of the lines in the red boxes should be commented out. Then it should work @MightismWyven
Honestly, since editing these values is causing bugs, try changing it to this:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local FirstPersonTeamName = "TeamA" -- change this to whatever team you want locked in first person. ALL other teams will have the default camera. It will update if you switch their team later.
function myTeamChanged()
local MyTeam = Player.Team -- see https://developer.roblox.com/en-us/api-reference/class/Team
-- Example of how you can detect the team by name:
if MyTeam.Name == FirstPersonTeamName then
Player.CameraMode = Enum.CameraMode.LockFirstPerson
else
Player.CameraMode = Enum.CameraMode.Classic
end
end
if Player.Team then
myTeamChanged()
end
Player.Changed:connect(function(Property)
if Property == "Team" or Property == "CameraMode" then
myTeamChanged()
end
end)
Everytime your CameraMode is changed, it should now change back. Hopefully the gun’s code wont intefere with that.
I would revert the gun code back to the original and then give the code above a shot.