Stage camera - view for all

Hi, does anyone know how I could include an event to make it so you can press a screen GUI button and it transitions to the stage for everyone in the server?

Local Script:
image

Server Script:
image

Any help will be appreciated!

3 Likes

you can use Enum.CameraType.Custom instead “Custom”

On the client, you need to detect the button click using something like button.MouseButton1Click in a local script. Connect this to a function that fires an event to the server (using remote events), from where you can validate the input and check their rank, then fire some remote event for all clients where a local script on each client detects the remote event, and then sets the camera to scriptable, and camera cframe.

The button localscript will look somewhat like this (with the button as the parent):

local button = script.Parent
local repStorage = game:GetService("ReplicatedStorage")
event = repStorage.requestChange
button.MouseButton1Click:Connect(function()
   event:FireServer()
end)

On the server:

local rs = game:getService("ReplicatedStorage")
local request = rs.requestChange
local change = rs.changeCamera
event.OnServerEvent:Connect(function(plr)
   if plr:GetRankInGroup(7) >= 0 then
      change:FireAllClients()
   end
end)

And on the client to change the camera:

local rs = game:GetService("ReplicatedStorage")
local camera = workspace.CurrentCamera
local camPart = workspace.Cam1
local event = rs.changeCamera
event.OnClientEvent:Connect(function()
   repeat camera.CameraType = enum.CameraType.Scriptable
      camera.CFrame = camPart.CFrame
   until camera.CFrame = camPart.CFrame
end

Keep in mind this might need a little tweaking but it’s round about what it might look like.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.