Moving the Camera Help

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.

  1. 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).
  2. 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.
  3. 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.

Client script:

	local camera = game.Workspace.CurrentCamera
	local Camera1 = game.Workspace.Camera1
	camera.CFrame = Camera1.FrontSurface
	end)

Server script:

game.Players.PlayerAdded:Connect(function(msg)
	if msg == ":camera" then -- do stuff with msg and player
		for _, p in pairs(game.Players:GetChildren()) do 
			remoteEvent:FireClient(p)
			-- 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
		end
	end
end)

I hope you can help me.

Kindest regards,
Waum_a.
1 Like

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.

2 Likes

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.

1 Like

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

2 Likes

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:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()


end)

With that taken noted, you then have to change the camera. By doing this:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
local cam = workspace.CurrentCamera

local com = workspace.camera1

repeat wait()

cam.CameraType = Enum.CameraType.Scriptable

until cam.CameraType == Enum.CameraType.Scriptable

while wait() do

cam.CFrame = com.CFrame

end
end)




You also need to find someway to make it so the camera is back to normal. Hope this helped.

1 Like

Well… make it scriptable. Camera.CameraType = Enum… etc