Hi! I’m currently working on a game in which one player is selected to be “the boss”. Essentially, their camera code focus around a boss part where they use certain abilities to eliminate enemies. This boss isn’t a character, so the player doesn’t take any control over them, their camera just watches it. I want to make it so the character of the player chosen doesn’t spawn in the map.
What I tried -
My first idea was to put the character into ReplicatedStorage. Doing that, however, makes all of their code stop functioning.
The only idea I have is having them spawn in a box that is very far from the map. Would there be a less band-aidy solution to doing this? Or should I stick with that. Thanks!
The main reason that the code probably stops is because the scripts are located in the Character which you move into the replicated storage.
Simply configuring them to work in the player, do make sure they are removed after they are no longer the “boss” as the player is one thing that remains constant and doesn’t refresh when the character dies, and then place these new scripts in the player when they are chosen.
I tried this early on in making this project. The camera script seems to not work properly within playerScripts. Could you help me fix this? I’m not entirely sure how it would work, I’m still trying to learn camera manipulation more in-depth.
local RunService = game:GetService("RunService")
local target = workspace.Boss -- The object to rotate around
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.Focus = target.CFrame
local rotationAngle = Instance.new("NumberValue")
local tweenComplete = false
local cameraOffset = Vector3.new(0, 200, 0)
local rotationTime = 15 -- Time in seconds
local rotationDegrees = 360
local rotationRepeatCount = -1 -- Use -1 for infinite repeats
local lookAtTarget = true -- Whether the camera tilts to point directly at the target
local rotatedCFrame = CFrame.Angles(0, math.rad(rotationAngle.Value), 0)
camera.CFrame = rotatedCFrame:ToWorldSpace(CFrame.new(cameraOffset))
if lookAtTarget == true then
camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
end