Hey there! So I was scripting a welcome screen for my new game, and I basically wanted this little loading animation I made to come up once the player clicks on the button ‘Play’.
However, when I try to run the script, I get an error saying that my object isn’t a object inside StarterGui.
Here is my StarterGui:
Here is the error I receive:
The code below is inside a WelcomeGui, which is in a frame where it runs from a button. I’ll share a picture of how it looks and then I’ll add the code:
(the LocalScript is inside the frame where this code is stored in)
Code:
local PlayerGui = game.Players.LocalPlayer:WaitForChild('PlayerGui')
local welcomeScreen = script.Parent.Parent.Frame
local loading = game.StarterGui.PlayLoadingScreen.Frame
local playButton = script.Parent.Play
local settingsButton = script.Parent.Settings
local storeButton = script.Parent.Store
playButton.MouseButton1Click:Connect(function()
loading.Parent = PlayerGui
loading.Visible = true
welcomeScreen.Visible = false
wait(9)
loading.Visible = false
end)