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.
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then Local Player = game:GetService("Players").LocalPlayer local Torso = Player.Character:WaitForChild("Torso") local ZoomDistance = 1 local Position = Vector3.new()-- put your position here in the () if it won't work take of Vector3.new Player.CameraMaxZoomDistance = 1 if Torso ~= nil then Torso.CFrame = CFrame.new(Position) end end end 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.local part = script.Parent; local players = game:GetService("Players"); part.Touched:Connect(function(obj) local hum = obj.Parent:FindFirstChild("Humanoid"); if hum then local char = obj.Parent; local plr = players:GetPlayerFromCharacter(char); plr.CameraMode = Enum.CameraMode.Classic; end end)
~~ KingLoneCat