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

How come my script to change the text of a textlabel when i press the imagebutton isn't working?

What I want to do is make code so that I cycle through messages and when Im done it closes but it wont Work plz help me here is code

local But = script.Parent
local Txt = game.StarterGui.ScreenGui.Frame.TextLabel
function onClick()
	if Txt.Text == "Open The Scroll, there are wars coming,to open just click anywhere. To learn of the past." then
		Txt.Text = "Long ago in this exact village Naruto Uzumaki(you) fought Pain/ Nagato and became the hero of the village hidden in the leaves"
	elseif Txt.Text == "Long ago in this exact village Naruto Uzumaki(you) fought Pain/ Nagato and became the hero of the village hidden in the leaves" then
		Txt.Text = "Long ago in the same village His friend Sasuke left in search of power to kill his brother but after learning a secret about his brother Sasuke vowed to destroy the Hidden Leaf village"
	elseif Txt.Text == "Long ago in the same village His friend Sasuke left in search of power to kill his brother but after learning a secret about his brother Sasuke vowed to destroy the Hidden Leaf village"then
		Txt.Text = "It is now the fourth great war of the ninjas and time to  stop a major league villain once and for all"
	elseif Txt.Text == "It is now the fourth great war of the ninjas and time to  stop a major league villain once and for all"then
		Txt.Text = "BTW Road to Boruto is coming out soon but in beta so you have to pay maybe 25 - 50 roux for it, but it will be free by october 26th, 2020, and if i get enough support i will remaster Storm 1,Storm 2 ,and Storm 3,and even a custom ninja battle ground with ninja from every game, (even though Road to boruto will already have that)"
	elseif Txt.Text == "BTW Road to Boruto is coming out soon but in beta so you have to pay maybe 25 - 50 roux for it, but it will be free by october 26th, 2020, and if i get enough support i will remaster Storm 1,Storm 2 ,and Storm 3,and even a custom ninja battle ground with ninja from every game, (even though Road to boruto will already have that)"then
		Txt.Text = "Go to Granny Tsunade to Figure where you need to go"
	else
		But.Parent.Visible = false
	end
end
But.MouseButton1Down:Connect(onClick())

1 comment

0
  1. Make sure the script is a local script.

2 answers

✓ Accepted answer
  1. Make sure the script is a local script. And 2. Make sure it's located in the screengui, due to the fact that startergui can't be accessed by server-side scripts.

3 comments

0

still isn't working doing the same exact thing as when I was using a script

0

Oops u were right I accidentall accesed the textlabe with game.startergui.frame.textlabel instead of script.parent.parent.textlabel

0

Great!

Remove the () from the connected function. So it would looked like (onClick)

1 comment

0

for some reason it doesnt showw my other text it just closes but you solution kinda worked cause it actually closed

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