I’m honestly so confused… It should work, it kinda does… But…
I wont include the entire script because there are 18 Cameras but basically I am scripting security cameras that takes the current camera and when you press the Right Arrow it’ll cycle through cameras.
1,2,3 etc etc. However when you first activate the script it by default forces you into Camera one. I can then cycle through 1,2,3 normally. When I get to Camera 18 and then try to loop back to 1, the output tells me I was at 1 but immediately places me on Camera 2. I don’t know why it won’t work because when you look at the script it should… I tried to remove the forcing to camera 1 on start but then that just breaks the script. I will add the script showing what i mean…
| Script |
game.ReplicatedStorage.SecurityCameraEvent.OnClientEvent:Connect(function()
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Cam1.CFrame
print(""..player.Name.." is on Cam 1")
-- Copy from 21 to 29 -- for more cams -- (just a note for me lol)
HERE-- UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Right then
if Camera.CFrame == Cam1.CFrame then
Camera.CFrame = Cam2.CFrame
print(""..player.Name.." is on Cam 2")
end
end
end
end)
------------------------------------------
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Right then
if Camera.CFrame == Cam2.CFrame then
Camera.CFrame = Cam3.CFrame
print(""..player.Name.." is on Cam 3")
end
end
end
end)
------------ ALL OTHER CAMERAS --------------
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Right then
if Camera.CFrame == Cam18.CFrame then
Camera.CFrame = Cam1.CFrame
print(""..player.Name.." is on Cam 1")
end
end
end
end)
To Here.
For some reason it skips Camera 1 and goes straight to Camera 2
If i need to explain more i can…