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

I am having trouble with Camera Manipulation. Please help?

Asked by 7 years ago

So basically what I am having trouble with is, when Title.Playbutton is clicked, everything works fine except the cam.CameraSubject. Everything from line 7 and up works, line 9 and down is where I am ahving issues. Thank you for taking your time to deal with my dumb issues., :)

cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
intro = player.PlayerGui:WaitForChild("Intro")

cam.CameraSubject = game.Workspace.IntroFocus
cam.CameraType = "Attach"
Instance.new("BlurEffect", cam).Size = 11

intro.Title.PlayButton.MouseButton1Click:connect(function()
    cam.CameraSubject = player.Character.Humanoid
    cam.CameraType = "Fixed"
    print'camerafix'
end)
0
What is the issue specifically? 1N0body 206 — 7y
0
On line 10, the camerasubject of cam doesnt go back to the LocalPlayer's Humanoid. ObscureIllusion 352 — 7y
0
Is this in a localscript? Does it give any errors? 1N0body 206 — 7y
0
It is indeed a local script, and no it does not give any errors. ObscureIllusion 352 — 7y

1 answer

Log in to vote
0
Answered by
1N0body 206 Moderation Voter
7 years ago
Edited 7 years ago

Ok, I've tried to recreate the problem and seems out it is way more complicated than I thought.

Here is the final script I put into which I believe is the solution:

local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local intro = player.PlayerGui:WaitForChild("Intro")

cam.CameraSubject = game.Workspace.IntroFocus
cam.CameraType = "Scriptable"

cam.CoordinateFrame = CFrame.new(workspace.IntroFocus.Position)  --Position of target
                           * CFrame.Angles(0, angle, 0) --Rotates in radians(math.rad)
                           * CFrame.new(0, 0, 8)       --Move the camera backwards
-- If you don't want this then just delete and put back the CameraType to 'Attach'; but I ran into 
-- issues using it.

Instance.new("BlurEffect", cam).Size = 11

intro.Title.PlayButton.MouseButton1Click:connect(function()
    cam.CameraSubject = player.Character.Humanoid
    cam.CameraType = "Custom" -- this returns the cameraPostion back to the player
game:GetService('RunService').RenderStepped:wait() -- wait till the camera gets rendered and does not overwrite.
  cam.CameraType = 'Fixed' 
    print'camerafix'
end)

Not sure if this will work out for you, but this the best I could do

EDIT: Code edited

0
Nope, sadly didnt work ): I mean, everything works but the camera subject still doesnt change to the player's humanoid. ObscureIllusion 352 — 7y
0
Oh.. Yeah, I know why. Need to add a wait() between line 18 and 19, wait till I edit the code with a proper wait method (script does things faster then the camera rendering, most likely) 1N0body 206 — 7y
0
Ok there you go 1N0body 206 — 7y
0
Okay so everything works, except that when you click the playbutton button, and it goes back to your humanoid, it just sticks to one place, like it doesnt move along with the humanoid, just stays there in the same place where the Humanoid was when you pressed the PlayButton. ObscureIllusion 352 — 7y
View all comments (2 more)
0
Remove line 19 and 20 1N0body 206 — 7y
0
Ah thank you! :) ObscureIllusion 352 — 7y
Ad

Answer this question