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

Camera LocalScript Not Functioning?

Asked by
sammiya1 134
8 years ago
01local rooms = game.Workspace:WaitForChild("Rooms")
02local camera = game.Workspace:WaitForChild("Rooms"):WaitForChild("Camera1")
03local target = game.Workspace:WaitForChild("Rooms"):WaitForChild("Target1")
04local cam = game.Workspace.CurrentCamera
05local Button = script.Parent
06 
07 
08function SendCamera()
09wait(10)
10cam.CameraSubject = camera
11cam.CameraType="Custom"
12cam.Focus=CFrame.new(target.Position)
13cam.CoordinateFrame= CFrame.new(camera.Position)
14end
15 
16if cam.Cameratype="Custom" then
17cam.Cameratype="Scriptable"
18Button.MouseButton1Click:connect(SendCamera)

Tried all possible with this and it wont work

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Where to start?

I'll be very pedantic and picky so you can make the most out of your code! The more efficient the better! If this still doesn't work, try rethinking the algorithm as I've no idea what it's supposed to be doing.

01local rooms = game.Workspace:WaitForChild("Rooms") -- make sure these all exist first, the new updates should mean that warnings are triggered if this is the reason for its failure.
02local camera = game.Workspace:WaitForChild("Rooms"):WaitForChild("Camera1")
03local target = game.Workspace:WaitForChild("Rooms"):WaitForChild("Target1")
04-- ^ change the "game.Workspace:WaitForChild("Rooms")" in camera and target to just "rooms"
05-- (sorry for being pedantic xD)
06local cam = game.Workspace.CurrentCamera
07local Button = script.Parent
08 
09 
10function SendCamera()
11    wait(10) -- Is this wait meant to be here? Just curious
12    cam.CameraSubject = camera
13    cam.CameraType="Custom" -- THIS NEEDS TO BE SCRIPTABLE (Enum.CameraType.Scriptable)
14    cam.Focus=CFrame.new(target.Position)  -- this doesn't include rotation, change this to "cam.Focus=target.CFrame"
15    cam.CoordinateFrame= CFrame.new(camera.Position) -- this too doesn't include rotation, change this to "cam.CoordinateFrame=camera.CFrame"
View all 22 lines...

Cheers :) CD

Ad

Answer this question