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

I was making a unforce first person button?

Asked by 7 years ago

so i have my game in force first person mode and i want to make a special button so that people who want to have their camera not in first person can zoom in and out. (when they step on the part)

this is the script i make but it doesnt work. Im not a very good scripter.

01function OnTouch(HIT)
02    wait(1)
03    Player.CameraMaxZoomDistance = 1
04    Player.OnTouch:connect(function(HIT)
05        wait(WaitTime)
06        local Torso = Character:FindFirstChild("Torso")
07        if Torso ~= nil then
08            Torso.CFrame = CFrame.new(Position)
09        end
10    end)
11end)

please help me fix this as for i suck at scripting thanks!

1 answer

Log in to vote
1
Answered by 7 years ago

Hi, I am greatneil80 and this is the list of items that needs to be fixed.. WaitTime isn't a thing, you didn't define it, it will give an error, index to global 'WaitTime' i suppose.. And Position isn't a thing so it will also say index to global 'Position'.. Player isn't defined just like WaitTime and neither is Position, Character isn't defined either.. I would do something like this..

Place this in the part that is touched:

01function 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 =  Vector3.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
14end
15script.Parent.Touched:connect(onTouched)

~Greatneil80~

(remember to accept answer if it works)

0
It does not let me zoom out when touched sweetlittlegirlohhl -22 — 7y
1
change the zoom distance greatneil80 2647 — 7y
0
i already did that sweetlittlegirlohhl -22 — 7y
0
oh and also, i already have my game camera mode set to lock first person i dont know if that matters though sweetlittlegirlohhl -22 — 7y
1
okay, then remember for position, the variable, make it either CFrame or remove the vector3.new greatneil80 2647 — 7y
Ad

Answer this question