I need help on getting a local script that enables a certain camera manipulation and then disables after a certain time. Can someone help me with it since it doesn't work. I tried to clone the camera local script from ReplicatedStorage to StarterGui then destroys the script so that the camera stops, but it didn't work why?
1 | game.ReplicatedStorage.Camera:Clone().Parent = |
2 | game.StarterGui |
3 | wait( 15 ) |
4 | game.StarterGui.Camera:Destroy() |
Why parent a camera to starter gui? CurrentCamera is the best way, because you'd be configuring the options for the player's camera.
1 | local Camera = workspace.CurrentCamera |
2 | -- If you want just the localplayer's camera to change, configure the camera using a localscript. |
3 | Camera.CameraType = "Custom" -- You'll need more understanding to use the camera types. |
You could use CameraSubject
to change the cameras primary focus part.
It's some cool stuff.
Heres how I did it
1 | local camera = game.Workspace.Camera |
2 | local cameraposition = script.Parent.PartPos --This is for the position of the camera |
3 |
4 | repeat Camera.CameraType = Enum.CameraType.Scriptable untilCamera.CameraType = = Enum.CameraType.Scriptable -- I know this looks extreme but it ensures that the cameratype changes properly |
5 | repeat Camera.CFrame = cameraposition.CFrame until Camera.CFrame = = cameraposition.CFrame |
Tell me if you find a better solution