I am making a loading screen which zooms in on a logo and shows a ‘loading’ text which works perfectly in studio. However, when loading on an actual game the loading screen no longer works and glitches as shown in the video below.
https://gyazo.com/c10578c5232e34e1b25c53246dfba039
As you can see, the camera changes back to custom and almost ‘resets’ which doesn’t happen in studio, and I frankly have no idea why after trying multiple solutions; here is my code.
-- Services
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
-- Variables
local Camera = game.Workspace.Camera
local CameraStart = game.Workspace.CameraStart
local CameraEnd = game.Workspace.CameraEnd
local Block = game.Workspace.Block.Part
-- Disable any other loading screen
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
PlayerGui:SetTopbarTransparency(0)
-- Tween information
local Info = TweenInfo.new(
3, -- length
Enum.EasingStyle.Linear, -- style
Enum.EasingDirection.In, -- direction
0, -- repeat
false, --reverse
0 --delay
)
-- Where tween is going
local Goals =
{
CFrame = CameraEnd.CFrame
}
local MoveCamera = TweenService:Create(Camera, Info, Goals)
--Event for when the tween has completed to blur and put a play button
MoveCamera.Completed:Connect(function(PlaybackState)
if PlaybackState == Enum.PlaybackState.Completed then
game.Workspace.Camera.CFrame = CameraEnd.CFrame
for i = 1,15 do
game.Lighting.Blur.Size = game.Lighting.Blur.Size + 1
wait(0.05)
end
game.Players.LocalPlayer.PlayerGui.Loading.Loading.Visible = true
end
end)
-- Move camera
wait()
Camera.CameraType = "Scriptable"
Camera.CFrame = CameraStart.CFrame
--wait(0.5)
MoveCamera:Play()