How to change 2D camera to default camera when i touch a brick? [Updated and Urgent]
Asked by
8 years ago Edited 8 years ago
I have a 2d camera setup made for my upcoming platformer (you cant move the camera and it follows you) I want to unlock it, and make it turn into normal camera when I touch a brick. For example, at the end of a level when I touch a brick to teleport to the lobby, I want the camera to unlock.
03 | p.CameraMinZoomDistance = 5 |
05 | while not p.Character or not p.Character.Parent do wait(. 1 ) c = p.Character end |
06 | c:WaitForChild 'HumanoidRootPart' |
07 | script.bpos:Clone().Parent = c.HumanoidRootPart |
10 | for _,p in next , game.Players:GetPlayers() do |
11 | if p.Character and p.Character.Parent then |
14 | p.CharacterAdded:connect( function () |
19 | game.Players.PlayerAdded:connect( function (p) |
20 | p.CharacterAdded:connect( function () |
02 | p = game.Players.LocalPlayer |
03 | rs = game:GetService( 'RunService' ) |
04 | cam = workspace.CurrentCamera |
05 | cam.CameraType = 'Scriptable' |
07 | rs.RenderStepped:connect( function () |
08 | if p.Character and p.Character:FindFirstChild( 'HumanoidRootPart' ) then |
09 | cam.CoordinateFrame = CFrame.new(Vector 3. new( |
11 | p.Character.HumanoidRootPart.Position.y+ 1.5 , |
12 | p.Character.HumanoidRootPart.Position.Z |
14 | p.Character.HumanoidRootPart.Position) |
3 | cam = game.Workspace.CurrentCamera |
5 | cam.CameraSubject = game.Workspace.Players |
6 | cam.CameraType = "Attach" |
This is a script I made to try and fix the issue I am getting, but it doesn't work at all
1 | script.Parent.Touched:connect( function () |
2 | game.ServerScriptService.SideCamServer.Disabled = true |
3 | game.StarterGui.SideCamClient.Disabled = true |
4 | game.ReplicatedFirst.CameraScript.Disabled = true |
I hope someone replies soon as I cannot continue my development with this issue