How do I make it like this?

ss

What I want to achieve:

  • The LoadBar is currently disabled, so basically I just want to enable this LoadBar Script but I seem to have a problem trying to enable it inside a script I put in ServiceScriptService.

  • My real goal is to make the Loading Bar show up whenever I put the Pizza inside the Oven, and I tried all my best but all I did, did not worked.

What I did:

  • I tried to make or define a variable or whatever this called (I am new to scripting sorry)
local load = game.Workspace.OvenBar:FindFirstChildWhichIsA('LoadBar')

and later on in the script I tried to enable it-

  • This is the script inside the Server Script Service
local player = game.Players.LocalPlayer
local click = game.Workspace.ClickPartOven.ClickDetector
local dough1 = game.Workspace.PizzaDough
local tomato1 = game.Workspace.TomatoSauce
local cheese1 = game.Workspace.Cheese
local peperonni1 = game.Workspace.Peperonni
local dough2 = game.Workspace.PizzaDough2
local tomato2 = game.Workspace.TomatoSauce2
local cheese2 = game.Workspace.Cheese2
local peperonni2 = game.Workspace.Peperonni2
local cpart1 = game.Workspace.CrossPart1
local cpart2 = game.Workspace.CrossPart2
local gui = game.Workspace.OvenBar:FindFirstChild('BillboardGui')
local load = game.Workspace.OvenBar:FindFirstChildWhichIsA('LoadBar')

click.MouseClick:Connect(function(player)
	if dough1.Transparency == 0 and tomato1.Transparency == 0 and cheese1.Transparency == 0 and peperonni1.Transparency == 0 then
		dough1.Transparency = 1
		tomato1.Transparency = 1
		cheese1.Transparency = 1
		peperonni1.Transparency = 1
		dough2.Transparency = 0
		tomato2.Transparency = 0
		cheese2.Transparency = 0
		peperonni2.Transparency = 0
		while wait(5) do
			gui.Disabled = false -- in here it says : ServerScriptService.OvenScript:27: attempt to index nil with 'Disabled' 
			load.Disabled = false
		end
		game.ServerStorage.Pizza:Clone().Parent = player.Backpack
		dough2.Transparency = 1
		tomato2.Transparency = 1
		cheese2.Transparency = 1
		peperonni2.Transparency = 1
		game.Workspace.PizzaBox.PizzaScript.Disabled = false
		wait (player)
	else
		cpart1.Transparency = 0
		cpart2.Transparency = 0
		wait(1)
		cpart1.Transparency = 1
		cpart2.Transparency = 1
	end

end)

AN ERROR:

Line 27: Disabled is not a valid member of BillboardGui "Workspace.OvenBar.BillboardGui

FOOTAGE OF THE GAMEPLAY
robloxapp-20220725-0049346.wmv (966.3 KB)

LOADING BAR FOOTAGE
robloxapp-20220725-0024235.wmv (67.8 KB)

So Yeah, you made it here

I tried to be specific and descriptive as possible cause I desperately need help :sweat_smile:

It’s because Disabled is not a property of a BillboardGui. You can use the property Enabled instead to dictate whether the gui is enabled or not.

RobloxScreenShot20220725_011144563

Ohh, so I did replaced it with Enabled = true , but the Load Bar did not work
also there is an error in Line 28

ServerScriptService.OvenScript:28: attempt to index nil with 'Enabled’

Is Load a frame? If so you have to use the property Visible for that.

So what I did was I changed it

ss

instead of

local load = game.Workspace.OvenBar:FindFirstChildWhichIsA('LoadBar')

I did

local load = game.Workspace.OvenBar:FindFirstChildWhichIsA('Loading')

and I replaced it with Visible

load.Visible = true

but there was still an error

ServerScriptService.OvenScript:28: attempt to index nil with ‘Visible’

Try renaming the variable to LoadBar instead, and also just use the :FindFirstChild() function, as it finds the first child named as the arguement. The arguement in this case is “Loading”, which is the name of the frame. You can do so here:

local loadbar = game.Workspace.OvenBar:FindFirstChild('Loading')

Using the :FindFirstChildWhichIsA() function is basically equivalent to saying, “I want to find the first child which is an alien” for example, as saying it wants to find the first child of that type or category.

For that function, you would use an instance, such as a part or gui for example.

1 Like

Yes, I changed it but it still says Visible is nil :confused:

try to use :FindFirstChild(“PutYourObjectNameHere”)

Yeah, I changed it to :FindFirstChild(‘Loading’) but I still get errors

show me please aaaaaaaaaaaaaaaaa

Sorry for late response, I’ll explain why it isn’t working.

Basically, OvenPart is a part that contains a billboard gui only. :FindFirstChild() only finds the CHILD of the part, so in this case you would use :FindFirstDescendant(). This function finds a DESCENDANT of the part, basically anything inside of the part, or inside of something in the part. Sorry for bad explanation.

Or, you can simply do just workspace.OvenBar.BillboardGui.Frame.Loading, which also works, but I would prefer :FindFirstDescendant().

2 Likes

This should work fine. Like this person said, you can simply do workspace.OvenBar.BillboardGui.Frame.Loading

1 Like

(i know quality looks bad)

omg I did what you said and now it’s working properly, Now I got a new problem which the load bar only works once but I’ll try to figure it out by myself first. Thank You for helping :slight_smile:

GAMEPLAY
robloxapp-20220725-1201235.wmv (2.4 MB)