Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

loading screen tween not working?

I am doing some test with this script from developer hub it works perfectly however when I tried to tween it only goes to haft way

output 13:31:44.726 - Players.gamingwithjbthepro.PlayerGui.LocalScript:34: invalid argument #3 (UDim2 expected, got boolean)

local ContentProvider = game:GetService("ContentProvider")
local Players = game:GetService("Players")

local localPlayer = Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
local screenGui = Instance.new("ScreenGui", playerGui)

local frame = Instance.new("Frame", screenGui)
frame.Size = UDim2.new(0.5, 0, 0.1, 0)
frame.Position = UDim2.new(0.5, 0, 0.5, 0)
frame.AnchorPoint = Vector2.new(0.5, 0.5)

local bar = Instance.new("Frame", frame)
bar.Size = UDim2.new(0, 0, 1, 0)
bar.Position = UDim2.new(0, 0, 0, 0)
bar.BackgroundColor3 = Color3.new(0, 0, 1)

local puddle = game.Workspace.Puddle
local Road = game.Workspace.Road


local assets = {
	puddle,
	Road
}

wait(3)

for i = 1, #assets do
	local asset = assets[i]
	ContentProvider:PreloadAsync({asset}) -- 1 at a time, yields
	local progress = i / #assets
	bar.Size = bar.Size + bar:TweenSize(UDim2.new(progress,0,1,0),"Out","Sine",1)
end

print("loading done")

I need help with this urgently because I gonna make my own version of this

1 answer

✓ Accepted answer

On line 33 you are doing this:

bar.Size = bar.Size + bar:TweenSize(UDim2.new(progress,0,1,0),"Out","Sine",1)

Which you are adding bar size to a function. Instead it is enought to do

bar:TweenSize(UDim2.new(progress,0,1,0),"Out","Sine",1)

If i am sure as TweenSize is function of a button so now it should be calling the function an tween the button size.

Also the reason why it says you are comparing bool is because TweenSize returns boolean whether the tween will play or not so it was compared to doing bar.Size = bar.Size + true (or false)

This discussion is preserved as it was. New answers, comments, and votes are closed.