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

Screen Gui and BoolValue isn't changing?

So I'm working on a loading screen, but when the "Play" button opens, if i click it, it does absolutely nothing.

local button = game.StarterGui.Loading.Frame.TextButton
local function onClick()
	if game.StarterGui.Loading.Frame.Loaded.Value == true then
		game.StarterGui.Loading.Enabled = false
	end
end

button.MouseButton1Click:Connect(onClick)

It looks like the "Loaded" Value isn't changing either.

Value is a boolValue, and here's the script to change it.

Button = game.StarterGui.Loading.Frame.TextButton
Gui = game.StarterGui.Loading
Value = game.StarterGui.Loading.Frame.Loaded.Value
Value = false
Gui.Enabled = true
script.Parent.Text = ("Loading...")
wait(math.random(1, 10))
Value = true
script.Parent.Text = ("Play")

1 answer

For the BoolValue part, I don't suggest using .Value in a variable. Try defining the object, then doing .Value on the variable. That might help with that.

On other hands, your Gui variable is incorrect. The StarterGui is where GuiObjects are cloned into the PlayerGui. This is a common mistake made by people, but it has an easy fix.

Try doing this on your Gui variable:

local player = game.Players.LocalPlayer
local Gui = player:WaitForChild("PlayerGui").Loading

That should fix it.

2 comments

0

Tried it, got this: Players.Roblozinko.PlayerGui.Loading.Frame.TextButton.Script:3: attempt to index nil with 'WaitForChild'

0

@roblozinko try checking your explorer to see if there's actually a thing called "loading"

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