for some reason the variable doubles?
here is my code
task.wait(3)
print("camsActivated")
local plr = game.Players.LocalPlayer
local char = plr.Character
local repstore = game:GetService("ReplicatedStorage")
local Cams = repstore.CamsRemotes.CamsTest
local turnonarrow = game.ReplicatedStorage.TurnOnCamGui
local point1 = CFrame.new(223.962, 15.625, 32.11)
local leftMove = CFrame.new(223.962, 15.625, 32.11) * CFrame.fromEulerAngles(0,-30,0)
local rightmove = CFrame.new(223.962, 15.625, 32.11) * CFrame.fromEulerAngles(0,30,0)
local partcam = game.Workspace.Cam1
local ts = game:GetService("TweenService")
local camera = workspace.CurrentCamera
local cam3 = game.Workspace.Cam3
local startingCam = TweenInfo.new(0,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
0
)
local moveleftinfo = TweenInfo.new(10,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0
)
local moveinfoRight = TweenInfo.new(20,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0
)
local moveinfoCenter = TweenInfo.new(10,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0
)
local enp = game.ReplicatedStorage.enableProxy
local uis = game:GetService("UserInputService")
--local tween = ts:Create(camera, startingCam, {["CFrame"] = point1})
--local leftMove = ts:Create(camera, moveleftinfo, {["CFrame"] = leftMove})
--local rightmove = ts:Create(camera, moveleftinfo, {["CFrame"] = rightmove})
local cam2 = game.Workspace.Cam2
local exit = game.ReplicatedStorage.CamsRemotes.Exit
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera --- make sure the camera is scriptable
local frame = plr.PlayerGui.ScreenGui.Frame
frame.Visible = false
local movecamLeft = ts:Create(partcam, moveleftinfo, {Orientation = Vector3.new(0,10,0)}) --0
local movecamRight = ts:Create(partcam, moveinfoRight, {Orientation = Vector3.new(0,-10,0)})
local movecamCenter = ts:Create(partcam, moveinfoCenter, {Orientation = Vector3.new(0,0,0)})
local movecamLeft2 = ts:Create(partcam, moveleftinfo, {Orientation = Vector3.new(0,70,0)}) -- 60
local movecamRight2 = ts:Create(partcam, moveinfoRight, {Orientation = Vector3.new(0,50,0)})
local movecamCenter2 = ts:Create(partcam, moveinfoCenter, {Orientation = Vector3.new(0,60,0)})
local movecamLeft3 = ts:Create(partcam, moveleftinfo, {Orientation = Vector3.new(0,-125,0)}) -- -135
local movecamRight3 = ts:Create(partcam, moveinfoRight, {Orientation = Vector3.new(0,-145,0)})
local movecamCenter3 = ts:Create(partcam, moveinfoCenter, {Orientation = Vector3.new(0,-135,0)})
local pend = game:GetService("RunService").RenderStepped:Connect(function()
end)
local rend
local camPages = 0
local CallBack = 1
local callback2 = 1
local callback3 = 1
local rightPressed = 0
local leftpressed = 0
local rightbutton = plr.PlayerGui.ScreenGui.Right
local leftbutton = plr.PlayerGui.ScreenGui.Left
turnonarrow.OnClientEvent:Connect(function()
rightbutton.Visible = true
leftbutton.Visible = true
end)
Cams.OnClientEvent:Connect(function()
camera.CameraType = Enum.CameraType.Scriptable
frame.Visible = true
rightbutton.Visible = true
leftbutton.Visible = true
camPages = camPages * 0
-----
CallBack = CallBack * 0
CallBack = CallBack + 1
callback2 = callback2 * 0
callback2 = callback2 + 1
callback3 = callback3 * 0
callback3 = callback3 + 1
rightPressed = rightPressed * 0
leftpressed = leftpressed * 0
print("poo")
print("poop")
-----
rend = RunService.RenderStepped:Connect(function()
Camera.CFrame = partcam.CFrame
print(camPages)
end)
rightbutton.MouseButton1Up:Connect(function()
CallBack = CallBack + 1
camPages = camPages + 1
rightPressed = rightPressed + 1
if camPages == 1 and rightPressed == 1 then
leftpressed = leftpressed - 1
leftbutton.Visible = true
partcam.CFrame = CFrame.new(cam2.Position)
movecamRight:Cancel()
movecamLeft:Cancel()
movecamCenter:Cancel()
movecamLeft3:Cancel()
movecamRight3:Cancel()
movecamCenter3:Cancel()
partcam.Orientation = Vector3.new(0,60,0)
while callback2 == 1 and camPages == 1 do
callback2 = callback2 - 1
wait(2)
movecamLeft2:Play()
task.wait(11)
movecamRight2:Play()
task.wait(21)
movecamCenter2:Play()
task.wait(11)
callback2 = callback2 + 1
end
elseif camPages == 2 and rightPressed == 2 then
leftpressed = leftpressed - 1
movecamRight2:Cancel()
movecamCenter2:Cancel()
movecamLeft2:Cancel()
movecamRight:Cancel()
movecamLeft:Cancel()
movecamCenter:Cancel()
partcam.CFrame = CFrame.new(cam3.Position)
partcam.Orientation = Vector3.new(0,-135,0)
while callback3 == 1 and camPages == 2 do
callback3 = callback3 - 1
wait(2)
movecamLeft3:Play()
task.wait(11)
movecamRight3:Play()
task.wait(21)
movecamCenter3:Play()
task.wait(11)
callback3 = callback3 + 1
end
elseif camPages == 0 then
rightPressed = rightPressed * 0
leftbutton.Visible = false
end
end)
leftbutton.MouseButton1Up:Connect(function()
callback2 = callback2 * 0
callback2 = callback2 + 1
camPages = camPages - 1
leftpressed = leftpressed + 1
if camPages == 0 then
rightPressed = rightPressed - 1
partcam.CFrame = CFrame.new(53.749, 17.362, -11.191)
movecamRight2:Cancel()
movecamCenter2:Cancel()
movecamLeft2:Cancel()
movecamLeft3:Cancel()
movecamRight3:Cancel()
movecamCenter3:Cancel()
while CallBack == 1 and camPages == 1 do
CallBack = CallBack - 1
wait(2)
movecamLeft:Play()
task.wait(11)
movecamRight:Play()
task.wait(21)
movecamCenter:Play()
task.wait(11)
CallBack = CallBack + 1
end
elseif camPages == 1 then
rightPressed = rightPressed - 1
movecamLeft3:Cancel()
movecamRight3:Cancel()
movecamCenter3:Cancel()
movecamRight:Cancel()
movecamLeft:Cancel()
movecamCenter:Cancel()
partcam.CFrame = CFrame.new(cam2.Position)
partcam.Orientation = Vector3.new(0,60,0)
while callback3 == 1 and camPages == 1 do
callback3 = callback3 - 1
wait(2)
movecamLeft2:Play()
task.wait(11)
movecamRight2:Play()
task.wait(21)
movecamCenter2:Play()
task.wait(11)
callback3 = callback3 + 1
end
end
end)
if camPages == 0 then
partcam.CFrame = CFrame.new(53.749, 17.362, -11.191)
movecamRight2:Pause()
movecamCenter2:Pause()
movecamLeft2:Pause()
movecamLeft3:Pause()
movecamRight3:Pause()
movecamCenter3:Pause()
while CallBack == 1 do
CallBack = CallBack - 1
wait(2)
movecamLeft:Play()
task.wait(11)
movecamRight:Play()
task.wait(21)
movecamCenter:Play()
task.wait(11)
CallBack = CallBack + 1
end
elseif camPages == 4 then
end
end)
frame.MouseEnter:Connect(function()
print("pooooop")
movecamRight2:Pause()
movecamCenter2:Pause()
movecamLeft2:Pause()
movecamLeft3:Pause()
movecamRight3:Pause()
movecamCenter3:Pause()
movecamRight:Cancel()
movecamLeft:Cancel()
movecamCenter:Cancel()
rend:Disconnect()
camera.CameraType = Enum.CameraType.Custom
enp:FireServer()
frame.Visible = false
rightbutton.Visible = false
leftbutton.Visible = false
end)
then this is my remoteEvent in serverscript for the proximity prompt
local proxy = script.Parent.ProximityPrompt
local repstore = game:GetService("ReplicatedStorage")
local cams = repstore.CamsRemotes.CamsTest
local numberOnOff = 0
local rs = game:GetService("RunService")
local pos = Vector3.new(105.289, -9.984, 167.513)
local enp = game.ReplicatedStorage.enableProxy
local screen = script.Parent
local onarrows = game.ReplicatedStorage.TurnOnCamGui
proxy.Triggered:Connect(function(plr)
cams:FireClient(plr)
proxy.Enabled = false
screen.Color = Color3.fromRGB(255, 255, 255)
wait()
--onarrows:FireClient(plr)
end)
enp.OnServerEvent:Connect(function()
proxy.Enabled = true
screen.Color = Color3.fromRGB(0, 0, 0)
end)