This is a really simple thing that I have managed to do before but aren’t able to do so now that I’m back after years, essentially I’m starting all over again (not that I was even experienced before) and want to begin with simple things such as Guis and simple code.
What I have here is a loading screen that doesn’t appear when I place it in ReplicatedFirst.
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local TweenService = game:GetService("TweenService")
local plr = Players.LocalPlayer
local gui = script.LobbyLoadingUI
local plrGui = plr:WaitForChild("PlayerGui")
local Main = script.LobbyLoadingUI.Main
local Bar = Main.Holder.Bar
local Assets = Main.Holder.AssetsLoaded -- text label that shows amount of assets loaded (all game descendants)
local skip = Main.Skip -- skip button that appears after 6 seconds if not finished loading
local tweenskip = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false)
local tweenrotate = TweenInfo.new(1.2,Enum.EasingStyle.Circular,Enum.EasingDirection.In,-1,false)
local UIGrad = skip.UIStroke.UIGradient
local TweenSkipBtn = TweenService:Create(skip, tweenskip, {skip.Position.Udim2.new(0,0,0.5,0)})
local TweenRotateGrad = TweenService:Create(UIGrad, {Rotation = 360})
gui.Parent = plr -- Not sure if this helps
ReplicatedFirst:RemoveDefaultLoadingScreen()
if not game:IsLoaded() then -- is this necessary?
--skip button
wait(6)
if Main.Enabled == true then
skip.Visble = true
TweenSkipBtn:Play()
task.wait(3)
UIGrad.Enabled = true
end
if UIGrad.Enabled == true then
TweenRotateGrad:Play()
end
end
I’m not sure what else am I missing that the ui does not appear. This is a localscript under ReplicatedFirst, and under this script is a ScreenGui I name ‘LobbyLoadingUI’ (Enabled turned on, works fine if its placed under StarterGui)
Also, just wanted to know in addition if I’m writing the tweeninfos correctly? I’ve always tweened UIs using ’ :Tweenposition(UDim2.new()) ’ so this is quite new to me.