Hello!
I am having an issue where my camera gets stuck where it was last placed (in my case, a fixed camera angle before getting deleted.)
I tried using fixed camera angles and switching it off which worked perfectly, but now it doesnt want to work.
There are alot of scripts in play that mess with map, cameras, player location, etc so I’ll only share the “problem children” (possibly), yet I am willing to share more if needed.
(LOCAL) Cutscene Script, Controls most of the “fixed” camera placement.
Note: This is only the part that matters.
...
animateGUI:FadeGUI(true)
curRunning = false
task.wait(1)
Events:FindFirstChild("switchMap"):FireServer("mainhouse")
end)
game:GetService("RunService").RenderStepped:Connect(function()
if curRunning then
local swaptocam = camerasfolder:FindFirstChild(curCam)
if swaptocam then
camera.CFrame = swaptocam.CFrame
end
end
end)
Events:FindFirstChild("switchMap").OnClientEvent:Connect(function()
coroutine.wrap(function()
for i=0.1,0,-0.01 do
script.music.Volume = i
task.wait(0.04)
end
script.music:Stop()
end)()
animateGUI:AnimateGUI(false)
animateGUI:FadeGUI(false)
end)
(SERVER) Level Switching Script, Switches the map for everyone
function mapSwitch(plr, prevMap)
local map = string.lower(prevMap)
mapLoader:ResetPlayers()
task.wait(1)
if map == "mainhouse" then
curMap = mapLoader:loadMap("SuburbsDark")
repeat task.wait() until curMap
if curMap then
mapLoader:teleportplayers(curMap)
Events:FindFirstChild("switchMap"):FireAllClients()
end
end
end
local loadedPlayers = {}
Events:FindFirstChild("switchMap").OnServerEvent:Connect(function(plr, prevMap)
table.insert(loadedPlayers, plr)
if #loadedPlayers == #game.Players:GetPlayers() then
print("EVERYONE LOADED")
mapSwitch(plr, prevMap)
end
end)
There is also the main camera script which is over 200 lines long and its so hard to pick out one single section so there’s that.
I tested this before in early development and it swapped between the camera script and the cutscene cameras just fine because they both use RenderStepped, but now it doesn’t.
Any help is appreciated and if you have any questions PLEASE ask.