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

How to lock first person by click in GUI?

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)

1 answer

✓ Accepted answer

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

2 comments

0

It's not that what I want

0

nvm, it works, Thank You!

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