I'm having trouble with this:
game.Players.PlayerAdded:connect(function(player)
if player.Teams == Spectators then
player.CameraMode = "LockFirstPerson"
end
end)
Thanks in advance!
I'm having trouble with this:
game.Players.PlayerAdded:connect(function(player)
if player.Teams == Spectators then
player.CameraMode = "LockFirstPerson"
end
end)
Thanks in advance!
function getTeamsColorFromName(name)
local color
for _,v in pairs(game.Teams:GetChildren()) do
if v.Name == name then
color = v.TeamColor
end
end
return color
end
game.Players.PlayerAdded:connect(function(player)
repeat wait() until player ~= nil -- This event is not very trust-worthy.
if player.TeamColor == getTeamColorFromName("Spectators") then
player.CameraMode = "LockFirstPerson"
end
end)
Broken down, the function at the top returns the Team's TeamColor from the name of it (Spectators) and then sets their CameraMode.
game.Players.PlayerAdded:connect(function(player)
if player.Teams == "Spectators" then
player.CameraMode = "LockFirstPerson"
end
end)
That should work? I can't test it, RobloxStudio crashes every 1 minute for me.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Don't use Studio's script editor. It crashes your game. Download Notepad++ and just copy + paste whenever you want to edit or something :p