I need help with cameras.
So basically, when I start the game, the camera works as usual. Unfortunately, whenever I try to set the camera to be the player’s cam, it simply leaves a floating point, in which the camera is stuck.
I tried everything. From simply changing some lines of code to whenever I needed to get those lines working, to simply re-doing the whole script. Here is the nightmare this whole thing’s about:
local function BlackScreen(waittime)
game.TweenService:Create(Player.PlayerGui.Game.BlackScreen,TweenInfo.new(0.5),{BackgroundTransparency = 0}):Play()
wait(waittime)
game.TweenService:Create(Player.PlayerGui.Game.BlackScreen,TweenInfo.new(0.5),{BackgroundTransparency = 1}):Play()
end
local function CameraSet(Bro)
local camera = game.Workspace.CurrentCamera
camera.CameraType = "Scriptable"
camera.CFrame = Bro.CFrame
end
local function CameraReset()
local camera = game.Workspace.CurrentCamera
local head = Player.Character:FindFirstChild("Head")
local humanoid = Player.Character:FindFirstChildOfClass("Humanoid")
-- this part is to avoid bad things, because my game has two types of humanoid applied to players.
camera.CameraType = "Custom"
camera.CFrame = head.CFrame
camera.CameraSubject = humanoid
end
local function CameraMove(Part,Part2,Time,EasingStyle)
local camera = game.Workspace.CurrentCamera
camera.CameraType = "Scriptable"
camera.CFrame = Part.CFrame
game.TweenService:Create(camera,TweenInfo.new(Time,EasingStyle),{CFrame = Part2.CFrame}):Play()
wait(Time-0.05)
end
CameraSet(game.Workspace.Lobby.Cameras.StartCam)
game.ReplicatedStorage.MusicAndSounds.MainMenuTheme:Play()
game.ReplicatedStorage.RemoteEvents.CameraEvent.OnClientEvent:Connect(function(mode,head)
elseif mode == "Cutscene1Start" then
Player.PlayerGui.Menu.Enabled = false
game.ReplicatedStorage.MusicAndSounds.MainMenuTheme:Stop()
wait(0.1)
game.TweenService:Create(Player.PlayerGui.Game.BlackScreen,TweenInfo.new(0.5),{BackgroundTransparency = 0}):Play()
wait(3)
game.TweenService:Create(Player.PlayerGui.Game.BlackScreen,TweenInfo.new(0.5),{BackgroundTransparency = 1}):Play()
if game.ReplicatedStorage.Values.Chosen.Map.Value == "City" then
CameraSet(game.Workspace.City.Cameras.StartCam)
Module.TextSet("Test",game.Players.LocalPlayer.Name,Color3.fromRGB(255, 255, 255))
wait(2)
Module.TextSet("Test2",game.Players.LocalPlayer.Name,Color3.fromRGB(255, 255, 255))
CameraMove(game.Workspace.City.Cameras.StartCam,game.Workspace.City.Cameras.StartCam2,2,Enum.EasingStyle.Quad)
CameraSet(game.Workspace.City.Cameras.StartCam2)
game.TweenService:Create(Player.PlayerGui.Game.BlackScreen,TweenInfo.new(0.5),{BackgroundTransparency = 0}):Play()
wait(0.5)
game.TweenService:Create(Player.PlayerGui.Game.BlackScreen,TweenInfo.new(0.5),{BackgroundTransparency = 1}):Play()
game.ReplicatedStorage.RemoteEvents.PlayerIntermissionEvents:FireServer("Leave")
game.ReplicatedStorage.RemoteEvents.CameraEvent:FireServer("CutsceneEnded")
wait(0.5)
CameraReset() -- this is the part that doesn't want to work, everything else works just fine.
Player.PlayerGui.Game.Game.Visible = true
wait(.25)
Player.PlayerGui.Game.CutsceneFrame.Visible = false
end
end
end)
If you have any ideas, on how do I make that work, could you leave them here?
Cheers, Cze.