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 make the player be forced into first person when he clicks play?

I am currently working on a menu GUI for my FPS (Design going well). In games like Phantom Forces, you can freely scroll around (being able to customize your weapon and such) until you click play, where it locks your player in first person until you die. I already have a code for making the menu disappear when you click play (it works), but how do I lock the player into first person once he does that?

This is the code for making the menu disappear when you click play, considering you guys might have wanted to see my progress with it.

bin = script.Parent

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

2 answers

✓ Accepted answer
script.Parent.MouseButton1Down:connect(function()
	game.Players.LocalPlayer.CameraMaxZoomDistance = .5
end)

thie is for a gui

script.Parent.Touched(function(hit)
	game.Players.LocalPlayer.CameraMaxZoomDistance = 400
end)

try using something like this for the zoom. to get it back when they die, google ondeath()

13 comments

0

Should I put this in the same script that I showed before? Or seperate?

0

just put this into your button. add other script under the mouse button1down

0

Add the other script under line 3 or under line 1?

0

under line one. line one is the function. when it fires, it triggers all the stuff between it and the end).

0

Alright. I'm going to bed. If it doesn't work I'll hit you up either here or on Roblox.

0

k

0

Hi, theCJarmy7. Yesterday I asked for help on Scripting Helpers and you gave me this code: script.Parent.MouseButton1Down:connect(function() game.Players.LocalPlayer.CameraMaxZoomDistance = .5 end) And well, it worked. The only problem that I had with this was when I reset my character, it didn't go out of first person mode. I will show you the script now, and maybe you can improve upon it? sc

0

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)

0

edited my answer, look at it now

0

Where should I put that edit you made in my script?

0

what edit?

0

You said you edited the script.

0

i edited my answer

4 comments

0

That's for the entire game though, right? I want it to be able to lock into first person right when the character presses "Play" on my menu.

0

You can reset it every time the player respawns.

0

I'm not quite understanding what you mean. I'm saying that I want the player to freely move his mouse around the menu to customize his weapon and such until he clicks play, which will lock him in first person when he is put in the battlefield. Example: https://www.youtube.com/watch?v=iUlO5I9kHSM (This is not mine.) He pretty much scrolls around the menu but once he clicks play he is locked into fi

0

rst person.

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