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

Why won't this Lock First Person script work?

Asked by 10 years ago

I put a LocalScript in the SpawnLocation. The LocalScript is:

script.Parent.Touched:connect(function(hit)
    humanoid = hit.Parent:FindFirstChild("Humanoid")
    if (humanoid ~= nil) then
        char = humanoid.Parent
        if (char ~= nil) then
            plr = char:GetPlayerFromCharacter()
            if (plr ~= nil) then
                plr.CameraMode = Enum.CameraMode.LockFirstPerson
            end
        end
    end
end)

2 answers

Log in to vote
0
Answered by
Bebee2 195
10 years ago

Replace line 6 with

plr = game.Players:GetPlayerFromCharacter(char)

You just used the method wrong.

0
You had fixed line 6. But the script still doesn't work. BosswalrusTheCoder 88 — 10y
0
Use a regular script in this instance, also. Bebee2 195 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

There, I think I fixed it now, I tested it out on Online Mode and it works, even when you reset.

wait(0)
plr=game:service("Players").LocalPlayer --No garentee that this'll work
wait(0)
plr.CameraMode=0
wait(0)
repeat wait(0)plr.CameraMode=1 until plr.CameraMode=="FirstPersonLock"
0
Oh... I forgot to mention. BEFORE SETTING TO FIRSTPERSONLOCK, SET ITMTO CLASSIC MODE THEN FIRSTPERSONLOCK. Bebee2 195 — 10y

Answer this question