I am making a game in which a part is a camera that faces the player and then stops doing that once a GUI button is pressed. I’ve looked online and haven’t found anything that seems to work. Does anyone know what ways I can make this type of system?
More specifically: I am creating a battle Royale inspired game in Roblox. With that game, I have a lobby where the player spawns when they join. When the player presses a button to go to the map, the camera needs to stop facing the player’s character (and the lobby itself) and focus on the player (like how a regular camera works in a regular roblox game; focuses on the player).
I already have the button, the teleportation, and disappearance of the button after it’s clicked, it is just the camera that won’t stop after the button is pressed.
Sorry if this doesn’t make that much sense to you, I tried to explain it the best I could. Assistance is greatly appreciated.
Can u explain how it triggers the camera? Does it trigger when the player enters? Like do you touch a part to face the player? If you explain more, I can help you with this.
It triggers when the player enters the game. I want it to stop once a GUI button is pressed. I do not know a way on how I could stop the camera script from another script for the GUI Button.
By setting the CameraType to scriptable, you can set the position and direction of the camera. The scriptable camera will only change based on instructions from a script.
local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
Since it doesn’t seem like you want to do anything too crazy, just go ahead and set the CFrame of the camera to where you want it to be. You can set the camera based on the character’s HumanoidRootPart, which CFrame can help with.
local player = game.Players.LocalPLayer
local function LobbyCam()
cam.CFrame = player.Character.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(180),0)*CFrame.new(0,0,5)
end
From there, setting the CameraType back to custom should bring it back to “normal”. Just adapt it with your own trigger and you should be good to go. Hope this helps!