Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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())
0
1. Make sure the script is a local script. AcrylixDev 119 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
  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.
0
still isn't working doing the same exact thing as when I was using a script ayuu_ondev 60 — 4y
0
Oops u were right I accidentall accesed the textlabe with game.startergui.frame.textlabel instead of script.parent.parent.textlabel ayuu_ondev 60 — 4y
0
Great! AcrylixDev 119 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
for some reason it doesnt showw my other text it just closes but you solution kinda worked cause it actually closed ayuu_ondev 60 — 4y

Answer this question