So i asked this question but it is still unsolved. ALSO, I ALREADY HAVE MY GAME IN LOCK FIRST PERSON MODE (just to say). I wanted to make a button that when you touch it, it lets you unlock first person mode and lets you zoom out. i made a script that didnt work and GreatNeil80 gave me another, but it doesnt work so here is the script he gave me.
01 | function onTouched(part) |
02 | local h = part.Parent:findFirstChild( "Humanoid" ) |
03 | if h~ = nil then |
04 | Local Player = game:GetService( "Players" ).LocalPlayer |
05 | local Torso = Player.Character:WaitForChild( "Torso" ) |
06 | local ZoomDistance = 1 |
07 | local Position = Vector 3. new() -- put your position here in the () if it won't work take of Vector3.new |
08 | Player.CameraMaxZoomDistance = 1 |
09 | if Torso ~ = nil then |
10 | Torso.CFrame = CFrame.new(Position) |
11 | end |
12 |
13 | end |
14 | end |
15 | script.Parent.Touched:connect(onTouched) |
please help
Hey sweetlittlegirlohhl,
Player
's CameraMode has been changed to LockFirstPerson
. Then, all you need to do when the Player
touches the part is to set that property of the Player
back to Classic
. In order for this to happen you need to just identify that it was a Character
that touched the part and then locate the Player
from the ServerScript
. Below is an example of how you would accomplish this.01 | local part = script.Parent; |
02 | local players = game:GetService( "Players" ); |
03 |
04 | part.Touched:Connect( function (obj) |
05 | local hum = obj.Parent:FindFirstChild( "Humanoid" ); |
06 | if hum then |
07 | local char = obj.Parent; |
08 | local plr = players:GetPlayerFromCharacter(char); |
09 | plr.CameraMode = Enum.CameraMode.Classic; |
10 | end |
11 | end ) |
~~ KingLoneCat