Hi! I want to make script which lock first person for player who's click the button but this script what I did doesn't works. Any ideas?
script.Parent.MouseButton1Click:connect(function() game.StarterPlayer.CameraMaxZoomDistance = 0.5 end)
It is because you are targeting StarterPlayer and not the actual Player. To do this you must be in a LocalScript.
Ex.
local plr = game.Player.LocalPlayer while true do plr.CameraMaxZoomDistance = 0.5 end
LocalPlayer just means the player the client is connected to
Its basicly the same as your script but plr
is added, the variable does not need to be named plr