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

Is it possible to cancel a camera script?

Asked by 5 years ago

So, basically what I'm doing is a loadout background. And once the player hits a certain text button, the script will cancel (allowing the camera to go back to the player and letting the player control their camera) while the script gets ready for the next time the player dies and respawns to apply again. Is it possible?

Current script

local Player=game.Players.LocalPlayer
local Char=Player.Character or Player.CharacterAdded:Wait()
local camera=workspace.CurrentCamera

wait(0.1)
camera.CameraType=Enum.CameraType.Scriptable
camera.CFrame=workspace.Cam.CFrame

1 answer

Log in to vote
0
Answered by 5 years ago

Alright so I would recommend adding something along the lines of this into your script.

This is in GUI Button form to fix the Camera.

You basically have to destroy the current camera and bring a new camera to workspace.

function buttondown()
game.Workspace.CurrentCamera:remove()
wait(.1)
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
end


script.Parent.MouseButton1Down:connect(buttondown)

Again, this is in GUI Button form so you'll have to tinker around a bit.

0
I'm a bit confused, I am using a GUI button and it isn't working. Or maybe I am doing something wrong, is there a part name I need to change? Used_Develop 14 — 5y
Ad

Answer this question