So in my game I have modified the StarterPlayer's values. However, when a player joins, it seems as though all of the values are switched back to default. Afterwords, I made this script in an attempt to stop this from happening, but it seems to have done nothing but throw this error:
16:25:27.773 - Workspace.cam_setter:4: attempt to index field 'CameraMinZoomDistance' (a number value) 16:25:27.775 - Stack Begin 16:25:27.776 - Script 'Workspace.cam_setter', Line 4 16:25:27.777 - Stack End
Here is my code:
game.Players.PlayerAdded:connect(function(plr)
wait(1)
local starter = game.StarterPlayer
starter.CameraMinZoomDistance.Changed:connect(function()
starter.CameraMinZoomDistance = 10
end)
starter.CameraMaxZoomDistance.Changed:connect(function()
starter.CameraMaxZoomDistance = 30
end)
starter.HealthDisplayDistance.Changed:connect(function()
starter.HealthDisplayDistance = 0
end)
starter.NameDisplayDistance.Changed:connect(function()
starter.NameDisplayDistance = 0
end)
end)
This is really puzzling me and I would appreciate it a lot if you could help me out with this. Thanks for reading.

1 comment
Try removing the PlayerAdded function, and the end) that ends it.