Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I am having trouble with Camera Manipulation. Please help?

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)

4 comments

0

What is the issue specifically?

0

On line 10, the camerasubject of cam doesnt go back to the LocalPlayer's Humanoid.

0

Is this in a localscript? Does it give any errors?

0

It is indeed a local script, and no it does not give any errors.

1 answer

✓ Accepted answer

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

6 comments

0

Nope, sadly didnt work ): I mean, everything works but the camera subject still doesnt change to the player's humanoid.

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)

0

Ok there you go

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.

0

Remove line 19 and 20

0

Ah thank you! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.