I want to make it so that if a Player in the Server clicks on a block, everyone’s camera in the server gets moved (manipulated) to view a certain position.
The thing is, I’m new to camera scripting and just scripting in general as well, so I watched some tutorials but well, they all used LocalScripts so only that player’s Camera was manipulated.
Now, how would I do this? I know I’d use a clickdetector.
This is the script that makes things move when one person in the server clicks a certain block. I want to add some lines so it moves EVERYONE’s camera to the moving parts when I click it. SERVERSCRIPT.
local clickdetector = game.Workspace.Ilum.Walls.DontTouchThis.ClickThis.ClickDetector
local GroupID = 8551076
local minimumRank = 60
local IlumOpen = false
local TweenService = game:GetService("TweenService")
local movingPart1 = game.Workspace.Ilum.Walls.SpecialWalls.Swall1:WaitForChild("CoreMovingPart") -- WaitForChild
local tweeningInformation = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local Open = {CFrame = CFrame.new(-39.27, 162.996, -1125.513)}
local Close = {CFrame = CFrame.new(-29.27, 162.996, -1125.513)}
local tween1open = TweenService:Create(movingPart1,tweeningInformation,Open)
local tween1close = TweenService:Create(movingPart1,tweeningInformation,Close)
clickdetector.MouseClick:Connect(function(Player)
if Player:GetRankInGroup(GroupID) >= minimumRank then
if IlumOpen == false then
tween1open:Play()
IlumOpen = true
elseif IlumOpen == true then
tween1close:Play()
IlumOpen = false
end
end
end)
You can just get everyone’s camera by using “for i, v in pairs(game.Players:GetChildren()) do” and then you can manipulate everyone’s camera at the same time.
It still doesn’t work, so here’s the ServerScript.
local clickdetector = game.Workspace.Ilum.Walls.DontTouchThis.ClickThis.ClickDetector
local GroupID = 8551076
local minimumRank = 60
local IlumOpen = false
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("IlumOpenEvent")
local TweenService = game:GetService("TweenService")
local movingPart1 = game.Workspace.Ilum.Walls.SpecialWalls.Swall1:WaitForChild("CoreMovingPart") -- WaitForChild
local tweeningInformation = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local Open = {CFrame = CFrame.new(-39.27, 162.996, -1125.513)}
local Close = {CFrame = CFrame.new(-29.27, 162.996, -1125.513)}
local tween1open = TweenService:Create(movingPart1,tweeningInformation,Open)
local tween1close = TweenService:Create(movingPart1,tweeningInformation,Close)
clickdetector.MouseClick:Connect(function(Player)
if Player:GetRankInGroup(GroupID) >= minimumRank then
if IlumOpen == false then
tween1open:Play()
IlumOpen = true
remoteEvent:FireAllClients()
elseif IlumOpen == true then
tween1close:Play()
IlumOpen = false
end
end
end)