Hello,I have been working on an fps game of mine, and I knew there would be alot of animations in the game to go with it. So I made a loading screen, but when the loading has finished and I’m playing the game. The animations that I cloned into the guns,tries to load even though I think It has loaded through the loading screen already, so it looks bad.
Is there a fix for this?!
Any help is appreciated.
repeat task.wait() until game:IsLoaded() == true
local player = game.Players.LocalPlayer
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false)
local LoadingService = game:GetService("ContentProvider")
local ThingsToLoad = {
Sounds = {
DescriptionText = "Loading Sounds"
};
Objects = {
DescriptionText = "Loading Objects"
};
Uis = {
DescriptionText = "Loading Images"
};
Animation = {
DescriptionText = "Loading Animations"
};
}
for i,v in pairs(game:GetDescendants()) do
if v:IsA("Sound") then
ThingsToLoad.Sounds[#ThingsToLoad.Sounds+1] = v
end
if v:IsA("BasePart") then
ThingsToLoad.Objects[#ThingsToLoad.Objects+1] = v
end
if v:IsA("Animation") then
ThingsToLoad.Animation[#ThingsToLoad.Animation+1] = v
end
if v:IsA("ImageButton") or v:IsA("Decal")or v:IsA("TextLabel") or v:IsA("TextButton") or v:IsA("ImageLabel") then
ThingsToLoad.Uis[#ThingsToLoad.Uis+1] = v
end
end
for i,v in pairs(ThingsToLoad.Sounds) do
if i ~= "DescriptionText" then
LoadingService:PreloadAsync({v})
script.Parent.Text = ThingsToLoad.Sounds.DescriptionText.." ("..i.."/"..#ThingsToLoad.Sounds..")"
end
end
for i,v in pairs(ThingsToLoad.Objects) do
if i ~= "DescriptionText" then
LoadingService:PreloadAsync({v})
script.Parent.Text = ThingsToLoad.Objects.DescriptionText.." ("..i.."/"..#ThingsToLoad.Objects..")"
end
end
for i,v in pairs(ThingsToLoad.Uis) do
if i ~= "DescriptionText" then
LoadingService:PreloadAsync({v})
script.Parent.Text = ThingsToLoad.Uis.DescriptionText.." ("..i.."/"..#ThingsToLoad.Uis..")"
end
end
for i,v in pairs(ThingsToLoad.Animation) do
if i ~= "DescriptionText" then
if v.Name == "Fire" then
print("Fire Animation Loaded")
end
LoadingService:PreloadAsync({v})
script.Parent.Text = ThingsToLoad.Animation.DescriptionText.." ("..i.."/"..#ThingsToLoad.Animation..")"
end
end
wait(1)
script.Parent.Text = "Loaded!"
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All,true)
local TweenService = game:GetService("TweenService")
local TweenInformation = TweenInfo.new(1,Enum.EasingStyle.Quint,Enum.EasingDirection.InOut,0,false,0)
local TweenInformation2 = TweenInfo.new(2,Enum.EasingStyle.Quint,Enum.EasingDirection.InOut,0,false,0)
local Dissapear = TweenService:Create(script.Parent.Parent.CommisionedImages,TweenInformation2,{BackgroundTransparency = 1})
delay(.5,function()
Dissapear:Play()
Dissapear.Completed:Connect(function()
script.Parent.Parent.CommisionedImages:Destroy()
end)
end)
delay(.5,function()
script.Parent:TweenPosition(UDim2.new(-0.25, 0,0.913, 0),"In","Back",.5)
end)
local BobloxLogo = script.Parent.Parent["Boblox Logo Background"]["Boblox Logo"]
BobloxLogo.SpinScript.Disabled = true
local SpinTween = TweenService:Create(BobloxLogo,TweenInformation,{Rotation = 0})
SpinTween:Play()
SpinTween.Completed:Connect(function()
BobloxLogo:TweenPosition(UDim2.new(.5,0,1.5,0),"In","Back",.75)
end)
The Code