My game which is coming out soon, most stuff are done. I have encountered a problem with my loading screen. The code seems to be fine in studio, but in game, the logo doesnt load like its supposed to. Here is the code.
--// Services
local ReplicatedFirst = game:GetService('ReplicatedFirst')
local TS = game:GetService('TweenService')
local Players = game:GetService('Players')
--// Variables
local player = Players.LocalPlayer
local playerGui = player:WaitForChild('PlayerGui')
local rotation = {}
rotation.Rotation = 5
local tweenInfo = TweenInfo.new(
1.2,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
-1,
true,
0
)
local screenUI = ReplicatedFirst:FindFirstChild('LoadingScreen')
screenUI.IgnoreGuiInset = true
screenUI.Parent = playerGui
playerGui:WaitForChild('Points').Enabled = false
playerGui:WaitForChild('UI').Enabled = false
playerGui:WaitForChild('MainUI').Enabled = false
local backFrame = playerGui:WaitForChild('LoadingScreen').BackFrame
local imageToTween = backFrame.WaterLabel
local textToChange = backFrame.Loaded
local tween1 = TS:Create(imageToTween, tweenInfo, rotation)
local tween2 = TS:Create(imageToTween, tweenInfo, {Rotation = -5})
textToChange.Text = "Loading.."
ReplicatedFirst:RemoveDefaultLoadingScreen()
tween1:Play()
tween2:Play()
wait(5)
if not game:IsLoaded() then
game.Loaded:Wait()
end
textToChange.Text = "Loaded!"
print('Loaded!')
backFrame:TweenPosition(UDim2.new(0.5,0,-5,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 2)
wait(1)
screenUI:Destroy()
playerGui:WaitForChild('Points').Enabled = true
playerGui:WaitForChild('UI').Enabled = true
playerGui:WaitForChild('MainUI').Enabled = true
So whats happening with my code? Any help would be nice :))