Greetings, I am wondering if anyone would know how I could edit the script I have done so it makes players who are in group 5682942 and rank 23 which presses a button their camera would go to the part. When they click it again their camera would go back to normal.
Script:
local Workspace = game:GetService(“Workspace”)
local PlayerService = game:GetService(“Players”)
local StarterGui = game:GetService(“StarterGui”)
local PlayerCamera = Workspace.CurrentCamera
local Camera = Workspace:FindFirstChild(“Stage_Camera”)
local Player = PlayerService.LocalPlayer
local Button = script.Parent
local OutputUI = script.Parent.Parent.Parent.Black_Screen
Button.MouseButton1Click:Connect(function()
local Viewing = script:GetAttribute("Viewing")
if PlayerCamera then
if Viewing == false then
OutputUI:TweenPosition(UDim2.new(4,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 2)
wait(1)
PlayerCamera.CameraType = Enum.CameraType.Scriptable
PlayerCamera.CameraSubject = Camera
PlayerCamera.CFrame = Camera.CFrame
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
script:SetAttribute("Viewing", true)
elseif Viewing == true then
OutputUI:TweenPosition(UDim2.new(-4,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 2)
wait(1)
PlayerCamera.CameraType = Enum.CameraType.Custom
PlayerCamera.CameraSubject = Player.Character.Humanoid
PlayerCamera.CFrame = Player.Character.Head.CFrame
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
script:SetAttribute("Viewing", false)
end
end
end)