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

I need help to fix my 2d camera script?

Asked by
jhgbug 15
11 years ago

how can i make this so u can't move it or zoom in or out

01repeat wait() until game.Players.LocalPlayer
02Player = script.Parent.Parent
03Character = Player.Character
04cam = Workspace.CurrentCamera
05campart1 = Workspace.campart:Clone()
06campart1.Parent = Character
07campart1.Position = Character.torso.Position
08cam.CameraType = "Attach"
09cam.CameraSubject = campart1
10 
11 
12function cam ()
13    campart1.Rotation = Vector3.new(0, 0, 0)
14    campart1.Position = Character.Torso.Position
15    FieldOfView = 40
16end
17game:GetService("RunService").RenderStepped:connect(cam)

1 answer

Log in to vote
1
Answered by 11 years ago

to lock zooming in you can add this to a script

1script.Parent = game.Players
2function onPlayerEntered(newPlayer)
3if newPlayer.ClassName == "Player" then
4newPlayer.CameraMode = "LockFirstPerson"
5end
6end
7game.Players.ChildAdded:connect(onPlayerEntered)

to lock zooming out you can add this to a new script

1script.Parent = game.Players
2function onPlayerEntered(newPlayer)
3if newPlayer.ClassName == "Player" then
4newPlayer.CameraMode = "LockThirdPerson"
5end
6end
7game.Players.ChildAdded:connect(onPlayerEntered)

and to add a really good 2D script add a new script and name it TwoD and type this

01function GetMass(object)
02    local mass = 0
03    if pcall(function() return object:GetMass() end) then
04        mass = object:GetMass()
05    end
06    for _,child in pairs(object:GetChildren()) do
07        mass = mass + GetMass(child)
08    end
09    return mass
10end
11 
12function onPlayerRespawned(newPlayer)
13    wait()
14    local torso = newPlayer.Character.Torso
15    local bp = Instance.new("BodyPosition")
View all 46 lines...

and add a local script into that script and type this

01lockCamera = false
02    distance = 30
03    height = 5
04 
05local torso = script.Parent.Torso
06local center = Instance.new("Part")
07center.Name = script.Parent.Name .. " Center"
08center.Transparency = 1
09center.CanCollide = false
10center.Size = Vector3.new(1,1,1)
11center.Position = torso.Position
12center.CFrame = CFrame.new(Vector3.new(0,0,0),Vector3.new(0,0,-1))
13center.Parent = game.Workspace
14local bp = Instance.new("BodyPosition")
15bp.position = center.Position
View all 34 lines...

hope this helps :)

Ad

Answer this question