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

Loading Screen Task Script Doesnt Work?

Asked by 2 years ago
Edited 2 years ago

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?

01local a = game.StarterGui.SurfaceGui.ImageLabel.Frame
02 
03wait(5)
04while task.wait(math.random(0.7,1.4)) do
05    if script.Parent.Parent.Value.Value < 100 then
06        script.Parent.Size = UDim2.new(0,a.Frame.Size.X.Scale + 4 , 0,40)
07        script.Parent.Parent.Value.Value += 1
08    elseif script.Parent.Parent.Value.Value == 100 then
09        break
10    end
11end

1 answer

Log in to vote
0
Answered by 2 years ago

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.

1local Player = game:GetService("Players").LocalPlayer
2local a = Player:WaitForChild("PlayerGui").SurfaceGui.ImageLabel.Frame
0
this isnt working, it might be cuz its a surfacegui and not a screengui JmoneyPlayzOfficial 49 — 2y
Ad

Answer this question