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

How do I unlock first person when the player dies?

I have made a script where once the player clicks "Play" on the menu, it makes the menu disappear and locks him in first person (Like in Phantom Forces, kind of.) The only problem I have with this script is that when the player dies, he is still locked into first person and is unable to click any of the buttons. Here is my script so far:

script.Parent.MouseButton1Down:connect(function()
bin = script.Parent

function Clicked()
bin.Parent.Visible = false 
end 
bin.MouseButton1Down:connect(Clicked)
	game.Players.LocalPlayer.CameraMaxZoomDistance = .5
end)
bin = script.Parent

function Clicked()
bin.Parent.Visible = false 
end 
bin.MouseButton1Down:connect(Clicked)

I want it so that when the player dies, he will be unlocked from first person to freely move around the menu.

1 answer

✓ Accepted answer

You can use the Died event and just set the MaxZoom to whatever you want.

Example:

game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
	game.Players.LocalPlayer.CameraMaxZoomDistance = 20
end)

I may have made a mistake, as I typed this without testing. Hope this helped!

6 comments

0

Also, your script looks a little strange. Is it working in the first place?

0

I tested it in studio and it works. I should test it on the site itself. And where would I put your code in my script?

0

Anywhere in the script is fine, it fires whenever the humanoid's health reaches 0.

0

Alright. I'll let you know if anything goes wrong.

0

Good news, it works. Thanks very much dude.

0

No problem.

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