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

GUI system won't work?

This will not make the GUI visible or not visible. The GUI's text is changed, but it does not appear on the screen. Why is this?

local Leaderboard = game.Players.LocalPlayer:WaitForChild("leaderstats")
local CeleGui = game.StarterGui:WaitForChild("Celebrate")

CeleGui.Frame.Visible = false

function celebrate()
	local player = game.Players.LocalPlayer
	CeleGui.Frame.Visible = true
	CeleGui.Frame.TextBox.Text = ""..player.Name.." has ranked up to "..Leaderboard.Rank.Value.."!"
	wait(3)
	CeleGui.Frame.Visible = false
end

Leaderboard.RankVal.Changed:connect(function(value)
	if value == 1 then Leaderboard.Rank.Value = "Newbie" elseif
		value == 2 then Leaderboard.Rank.Value = "Member" elseif
		value == 3 then Leaderboard.Rank.Value = "Forager" elseif
		value == 4 then Leaderboard.Rank.Value = "Watcher" elseif
		value == 5 then Leaderboard.Rank.Value = "Night Watcher" elseif
		value == 6 then Leaderboard.Rank.Value = "Warrior" elseif
		value == 7 then Leaderboard.Rank.Value = "Runner" elseif
		value == 8 then Leaderboard.Rank.Value = "Elder"
		celebrate()
end
end)

Leaderboard.RankVal.Changed:connect(function(value)
	celebrate()
end)

2 comments

0

What exactly is the error and where is it?

0

There is no error or output. This does not do anything when Celebrate is fired.

1 answer

✓ Accepted answer

Classic error. You're changing StarterGui and not PlayerGui

local Leaderboard = game.Players.LocalPlayer:WaitForChild("leaderstats")
local CeleGui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Celebrate") --Defines the player's current GUI instead of the StarterGUI.

CeleGui.Frame.Visible = false

function celebrate()
    local player = game.Players.LocalPlayer
    CeleGui.Frame.Visible = true
    CeleGui.Frame.TextBox.Text = ""..player.Name.." has ranked up to "..Leaderboard.Rank.Value.."!"
    wait(3)
    CeleGui.Frame.Visible = false
end

Leaderboard.RankVal.Changed:connect(function(value)
    if value == 1 then Leaderboard.Rank.Value = "Newbie" elseif
        value == 2 then Leaderboard.Rank.Value = "Member" elseif
        value == 3 then Leaderboard.Rank.Value = "Forager" elseif
        value == 4 then Leaderboard.Rank.Value = "Watcher" elseif
        value == 5 then Leaderboard.Rank.Value = "Night Watcher" elseif
        value == 6 then Leaderboard.Rank.Value = "Warrior" elseif
        value == 7 then Leaderboard.Rank.Value = "Runner" elseif
        value == 8 then Leaderboard.Rank.Value = "Elder"
        celebrate()
end
end)

Leaderboard.RankVal.Changed:connect(function(value)
    celebrate()
end)

Explanation

Changing StarterGuiwill only affect the Player's Gui after they respawn.But changing the PlayerGui changes it in real time.

1 comment

0

Thank you!

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