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

How to change a GUI text in a script?

Gui text changer: When the leaderstats is 1 the name on top of the screen changes to "Grassland" And some about the other onces, but whats wrong?

wait (2)

while true do
	if script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 1 then
		script.Parent.Text = "Grassland"
	elseif script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 0 then
		script.Parent.Text = "Waiting..."
	end
	if script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 2 then
		script.Parent.Text = "Winter land"
	elseif script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 0 then
		script.Parent.Text = "Waiting..."
	end
	if script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 3 then
		script.Parent.Text = "Desert"
	elseif script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 0 then
		script.Parent.Text = "Waiting..."
	end
	if script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 4 then
		script.Parent.Text = "Space"
	elseif script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 0 then
		script.Parent.Text = "Waiting..."
	end
end

1 answer

✓ Accepted answer

After some testing, providing the 'Mappy' thing is an Valueinstance then you must use Value.Value By using just one Value you are only selecting the actual property and not the value of it. So basically, try changing the:

script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == 1

to

script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value.Value == 1

------------------------------------------------------------------------------------------------------ Not exactly related to answering your question, but you can make this more efficient. Instead of typing out:

elseif script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy.Value == ___ then

You can assign this 'route' to one word, or a phrase, so you don't have to keep typing it out, like so:

Maps = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Mappy

Once you've done that, you can then do:

if Maps.Value.Value == ___ then

--------------------------------------------------------------------------------------------------------- If this answered your question, please do accept my answer with the box to the right. If this was unclear and want me to re-explain please do ask and of course, if it doesn't work do let me know

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