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.
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.
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
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.