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 6 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.

function OnTouch(HIT)
    wait(1)
    Player.CameraMaxZoomDistance = 1
    Player.OnTouch:connect(function(HIT)
        wait(WaitTime)
        local Torso = Character:FindFirstChild("Torso")
        if Torso ~= nil then
            Torso.CFrame = CFrame.new(Position)
        end
    end)
end)

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

1 answer

Log in to vote
1
Answered by 6 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:

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)

~Greatneil80~

(remember to accept answer if it works)

0
It does not let me zoom out when touched sweetlittlegirlohhl -22 — 6y
1
change the zoom distance greatneil80 2647 — 6y
0
i already did that sweetlittlegirlohhl -22 — 6y
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 — 6y
1
okay, then remember for position, the variable, make it either CFrame or remove the vector3.new greatneil80 2647 — 6y
Ad

Answer this question