Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to lock first person by click in GUI?

Asked by 4 years ago

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

Log in to vote
0
Answered by
Benbebop 1049 Moderation Voter
4 years ago
Edited 4 years ago

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

0
It's not that what I want ThadonROOX 47 — 4y
0
nvm, it works, Thank You! ThadonROOX 47 — 4y
Ad

Answer this question