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
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.
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().
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