Turn this script into server script

So i have this local script and i wanna make so everyone in the server changes his camera
i tried with remotes and i still got nothing can someone explain me how to turn it so all the server sees his camera changing

local player = game.Players.LocalPlayer

local camera = workspace.CurrentCamera

repeat wait()

camera.CameraType = Enum.CameraType.Scriptable

until camera.CameraType == Enum.CameraType.Scriptable

camera.CFrame = workspace.camera1.CFrame

camera.FieldOfView = 60

player.Chatted:Connect(function()

if player.TeamColor == BrickColor.new("Maroon") then

camera.CFrame = workspace.camera2.CFrame

end

end)

Try using a remote event with FireAllClients

It broke the script and still doesn’t work (30 charrrrsss)

Instead of saying ‘it doesn’t work’, perhaps provide us with the code you are using to fire to all the clients?

game.ReplicatedStorage.RemoteEvent:FireAllClients()

Can you please provide all of the code, including where you are firing?

This is the onserverevent code:

   script.Parent.OnServerEvent:Connect(function()
       
     local player = game.Players.LocalPlayer

     local camera = workspace.CurrentCamera

        repeat wait()

        camera.CameraType = Enum.CameraType.Scriptable

        until camera.CameraType == Enum.CameraType.Scriptable

        camera.CFrame = workspace.camera1.CFrame

        camera.FieldOfView = 60

        player.Chatted:Connect(function()

        if player.TeamColor == BrickColor.new("Maroon") then

        camera.CFrame = workspace.camera2.CFrame

        end

        end)

        end)

I’m asking for the full code that you’ve shown above. this is a completely separate script.

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
repeat wait()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = workspace.camera1.CFrame
camera.FieldOfView = 60

player.Chatted:Connect(function()
		if player.TeamColor == BrickColor.new("Maroon") then
			camera.CFrame = workspace.camera2.CFrame
		end
	end)

The firing code is only one line also

I don’t see the line where you are firing…

The firing script it’s a separated script

game.ReplicatedStorage.RemoteEvent:FireAllClients()

Why have you seperated it… what are you making trigger it?

Well i didnt separate it at all i just cut the code because i wanted to put on the OnServerEvent leaving the place where the code was empty and deleting the original place of it and put that firing event on another script this time a script not a local script, and maked a remote event on replicatedstorage and that remote event have the on server event script