Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i fix this code? ReplicatedFirst.LoadingScreenScript:40: attempt to index nil with 'IsA'

Asked by 2 years ago

here is the code, can anyone pls help me with it! local replicatedfirst = game:GetService("ReplicatedFirst") local contentprovider = game:GetService("ContentProvider") local tweenservice = game:GetService("TweenService") local players = game:GetService("Players")

local player = players.LocalPlayer local playergui = player:WaitForChild("PlayerGui") local loadingscreen = script:WaitForChild("LoadingScreen")

replicatedfirst:RemoveDefaultLoadingScreen()

repeat task.wait() until game:IsLoaded()

local assets = game:GetDescendants()

local clonedLoadingScreen = loadingscreen:Clone() clonedLoadingScreen.Parent = playergui

for i = 1, #assets do local asset = assets[i] local percentage = math.round(i / #assets * 100)

contentprovider:PreloadAsync({asset})

clonedLoadingScreen.Background.DisplayPercentage.Text = percentage.."%"

tweenservice:Create(clonedLoadingScreen.Background.BarBackground.Bar, TweenInfo.new(0.2,Enum.EasingStyle.Linear,  Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/ 100, 1)}):Play()

if i % 5 == 0 then
    task.wait()
end

if i == #assets then
    task.wait(1)

end

end

for i, v in pairs(clonedLoadingScreen:GetDescendants()) do if y:IsA("Frame") then tweenservice:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play() elseif v:IsA("TextLabel") then tweenservice:Create(v, TweenInfo.new(0.5),{TextTransparency = 1}):Play() end end

Answer this question