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

How do I unlock first person when the player dies?

Asked by 8 years ago

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

Log in to vote
0
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

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!

0
Also, your script looks a little strange. Is it working in the first place? Pyrondon 2089 — 8y
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? MariusAurelius 85 — 8y
0
Anywhere in the script is fine, it fires whenever the humanoid's health reaches 0. Pyrondon 2089 — 8y
0
Alright. I'll let you know if anything goes wrong. MariusAurelius 85 — 8y
View all comments (2 more)
0
Good news, it works. Thanks very much dude. MariusAurelius 85 — 8y
0
No problem. Pyrondon 2089 — 8y
Ad

Answer this question