-
What do you want to achieve?
A Camera System working. -
What is the issue?
I don’t exactly know the issue but it seems like it skips a few points and does weird stuff.
Here is the CameraPoints in the Explorer:
Here is the LoadingGuiScript and it’s Descendants in the Explorer:
Here is a Video of me Playing the Game:
Here is the Code, it is actually a Loading Screen with a little Camera Tweening System:
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
PlayerGui:SetTopbarTransparency(0)
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
local BlackGui = script.BlackGui
BlackGui.Parent = PlayerGui
-- The Camera Stuff begins here.
spawn(function()
local loopTime = 1
while true do
for point = 1, #workspace.CameraPoints:GetChildren(), 1 do
local object = workspace.CameraPoints[tostring(point)]
if point == 1 then
if loopTime == 1 then
workspace.CurrentCamera.CFrame = object.CFrame
else
TweenService:Create(BlackGui.Frame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundTransparency = 0}):Play()
task.wait(0.25)
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.001, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {CFrame = workspace.CurrentCamera.CFrame}):Play()
task.wait(0.01)
workspace.CurrentCamera.CFrame = object.CFrame
TweenService:Create(BlackGui.Frame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0), {BackgroundTransparency = 1}):Play()
end
else
if object:GetAttribute("Speed") > 0 then
local Time = (workspace.CurrentCamera.CFrame.Position - object.Position).magnitude / object:GetAttribute("Speed")
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(Time, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {CFrame = object.CFrame}):Play()
if point < #workspace.CameraPoints:GetChildren() then
if workspace.CameraPoints[tostring(point + 1)]:GetAttribute("Speed") < 1 then
task.wait(Time - 0.3)
else
task.wait(Time)
end
else
task.wait(Time - 0.3)
end
else
TweenService:Create(BlackGui.Frame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundTransparency = 0}):Play()
task.wait(0.25)
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.001, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {CFrame = workspace.CurrentCamera.CFrame}):Play()
task.wait(0.01)
workspace.CurrentCamera.CFrame = object.CFrame
TweenService:Create(BlackGui.Frame, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0), {BackgroundTransparency = 1}):Play()
end
end
end
loopTime += 1
end
end)
-- Almost all the Camera stuff is in the Spawn above.
local LoadingGui = script.LoadingGui:Clone()
LoadingGui.Parent = PlayerGui:WaitForChild("MainGuis")
LoadingGui:WaitForChild("LoadingThings").Fillbar.Disabled = false
local MainFrame = LoadingGui.MainFrame
local BlackFrame = LoadingGui.BlackFrame
local LoadingFrame = MainFrame.LoadingFrame
local Fillbar = LoadingFrame.Fillbar
local LoadingPercentage = LoadingFrame.LoadingPercentage
local PlayButton = MainFrame.PlayButton
local percentageCount = LoadingGui.LoadingThings.PercentageCount
task.wait(1)
local function Fill(fillPercentage,length)
TweenService:Create(percentageCount, TweenInfo.new((length - 0.3), Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Value = tonumber(fillPercentage)}):Play()
end
PlayButton.MouseButton1Click:Connect(function()
TweenService:Create(BlackFrame, TweenInfo.new(2.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundTransparency = 0}):Play()
PlayerGui.BlackGui:Destroy()
task.wait(2.6)
TweenService:Create(workspace.CurrentCamera.CFrame, TweenInfo.new(0.001, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {workspace.CurrentCamera.CFrame}):Play()
task.wait(0.01)
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
workspace.CurrentCamera.CameraSubject = player.Character.Humanoid
MainFrame.Visible = false
task.wait(0.5)
TweenService:Create(BlackFrame, TweenInfo.new(2.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundTransparency = 1}):Play()
end)
percentageCount.Changed:Connect(function(value)
if value == 100 then
PlayButton.PlayButtonEffectScript.Disabled = false
TweenService:Create(PlayButton, TweenInfo.new(1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {BackgroundTransparency = 0}):Play()
TweenService:Create(PlayButton, TweenInfo.new(1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {TextTransparency = 0}):Play()
TweenService:Create(PlayButton, TweenInfo.new(1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {TextStrokeTransparency = 0}):Play()
end
end)
repeat
task.wait()
if not percentageCount.Value == 90 then
local fillLength = math.random(1, 2)
Fill(math.random(percentageCount.Value + 1, percentageCount.Value + 6))
task.wait(fillLength + 0.1)
end
until game:IsLoaded()
Fill(100, 1.5)
- What solutions have you tried so far?
- Printing multiple places, all i found out was that it was skipping some points.
- Searching online, no problems like this.
- Now trying to find help on The Devforum.
The Camera points Rotations are how they are supposed to be, though the Camera tweens in another Weird Rotation that i do not want.
Help really Appreciated!