Hello Developers! I’m trying to do a camera command, I will now answer these questions, I hope you can help me, the code I used is provided by @ScriptingSausage but I did some changes.
What do you want to achieve? Keep it simple and clear!
I want do a camera command, like someone says “:camera” and everyone faces the stage, (without group rank because I don’t have a group).
What is the issue? Include screenshots / videos if possible!
I did it, but for some reasons is not working, I don’t have anything on the output.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried asking on other platform and they tried to help me, but it didn’t worked, sadly.
I want do something similiar as this: View Stage command, but without group rank. I have the code (the code is edited by mine but is of @ScriptingSausage.
local camera = game.Workspace.CurrentCamera
local Camera1 = game.Workspace.Camera1
camera.CFrame = Camera1.FrontSurface
if msg == ":camera" then -- do stuff with msg and player
for _, p in pairs(game.Players:GetChildren()) do
-- This part is optional, if you want the character to not be able to move.
p.Character.Humanoid.PlatformStand = true
p.Character.HumanoidRootPart.Anchored = true
I hope you can help me.
You could use Player:Chatted Chatted API and check what the player said. If they said the command, mainpulate the camera’s CFrame to make it face the stage. This might also be useful: Camera.
I revised the code I have, and it follows these things, something is wrong in my script, and I don’t know what is wrong with my script, I don’t have output errors.
You dont need Camera1.FrontSurface, you can just make sure the from surface is where you want it pointed then set the camera cframe to the cframe of the object
What do you mean? Do you mean do like all the part is the camera? So, I remove the .FrontSurface?
I removed the .FrontSurface and it still doesn’t works.
Are you using a remote event?
You haven’t defined a remote event anywhere in the script, that could probably be the the problem. You can’t fire a remote event if it doesn’t exist.
Also, why do you have an “end)” here? You need to check if the remote event was fired, you don’t need ends for tables. Check it got fired by doing:
With that taken noted, you then have to change the camera. By doing this:
local cam = workspace.CurrentCamera
local com = workspace.camera1
cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable
while wait() do
cam.CFrame = com.CFrame
You also need to find someway to make it so the camera is back to normal. Hope this helped.
Well… make it scriptable. Camera.CameraType = Enum… etc