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

How do I make the player be forced into first person when he clicks play?

Asked by 8 years ago

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

Log in to vote
0
Answered by
theCJarmy7 1293 Moderation Voter
8 years ago
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()

0
Should I put this in the same script that I showed before? Or seperate? MariusAurelius 85 — 8y
0
just put this into your button. add other script under the mouse button1down theCJarmy7 1293 — 8y
0
Add the other script under line 3 or under line 1? MariusAurelius 85 — 8y
0
under line one. line one is the function. when it fires, it triggers all the stuff between it and the end). theCJarmy7 1293 — 8y
View all comments (9 more)
0
Alright. I'm going to bed. If it doesn't work I'll hit you up either here or on Roblox. MariusAurelius 85 — 8y
0
k theCJarmy7 1293 — 8y
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 MariusAurelius 85 — 8y
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) MariusAurelius 85 — 8y
0
edited my answer, look at it now theCJarmy7 1293 — 8y
0
Where should I put that edit you made in my script? MariusAurelius 85 — 8y
0
what edit? theCJarmy7 1293 — 8y
0
You said you edited the script. MariusAurelius 85 — 8y
0
i edited my answer theCJarmy7 1293 — 8y
Ad
Log in to vote
0
Answered by
XAXA 1569 Moderation Voter
8 years ago

Setting Player.CameraMode to Enum.CameraMode.LockFirstPerson should work.

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. MariusAurelius 85 — 8y
0
You can reset it every time the player respawns. XAXA 1569 — 8y
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 MariusAurelius 85 — 8y
0
rst person. MariusAurelius 85 — 8y

Answer this question