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

Loading Screen Task Script Doesnt Work?

im making a loading script for a task, this script is supposed to change the size and break the script when loaded to 100, but it isn't working, can anyone help?

local a = game.StarterGui.SurfaceGui.ImageLabel.Frame

wait(5)
while task.wait(math.random(0.7,1.4)) do
	if script.Parent.Parent.Value.Value < 100 then
		script.Parent.Size = UDim2.new(0,a.Frame.Size.X.Scale + 4 , 0,40)
		script.Parent.Parent.Value.Value += 1
	elseif script.Parent.Parent.Value.Value == 100 then
		break
	end
end

1 answer

On the first line where you declared the variable a, you had gotten the StarterGui. This won't do anything because you're not directly editing the player's UI. When the game is run, the ui in StarterGui gets replicated into Player.PlayerGui. To fix this, get the local player and then get the UI.

local Player = game:GetService("Players").LocalPlayer
local a = Player:WaitForChild("PlayerGui").SurfaceGui.ImageLabel.Frame

1 comment

0

this isnt working, it might be cuz its a surfacegui and not a screengui

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