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

Why won't this Lock First Person script work?

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

✓ Accepted answer

Replace line 6 with

plr = game.Players:GetPlayerFromCharacter(char)

You just used the method wrong.

2 comments

0

You had fixed line 6. But the script still doesn't work.

0

Use a regular script in this instance, also.

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"

1 comment

0

Oh... I forgot to mention. BEFORE SETTING TO FIRSTPERSONLOCK, SET ITMTO CLASSIC MODE THEN FIRSTPERSONLOCK.

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