Story won't work

Hello everyone! So I’m making this story thing that you can read but somethings not working in my LocalScript. You can check it here:

local button = script.Parent
local storyText = script.Parent.Parent.StoryText
local page = 1

button.MouseButton1Up:Connect(function()
    if page == 1 then
	    storyText.Text = "One day, Nooblet decided to watch the news on his TV."
	    page += 1
    elseif page == 2 then
	    storyText.Text = "He saw that Robloxia was being invaded by hackers!"
	    page += 1
	elseif page == 3 then
    	storyText.Text = "He didn't mind and went to guy buy some chips."
	    page += 1
    elseif page == 4 then
    	storyText.Text = "All of a sudden, a shady figure comes and says, 'want some robux kid?'"
    	page += 1
	elseif page == 5 then
    	storyText.Text = "Little did Nooblet know, that was David Baszucki! He was trying to lure people to join the Robloxia war with the hackers."
	    page += 1
    else
	    storyText.Text = "Nooblet of course says yes to the free robux. This is where your story begins. You will fight for the freedom of Robloxia!"
	    button.Visible = false
    end
end)

For some reason, the pages wont change whenever I click it. Please let me know if I did anything wrong. Thanks for reading!

Are there any errors in the output?

1 Like

No, there appears to be no errors.

Can you add a print(page) in the function and see if it prints?

1 Like

Nothing is printing in the output.

Why don’t you do page = 2, page = 3 etc?
I think it would be better done that way rather than page += 1
Also, shouldn’t it be MouseButtonDown rather than up?

1 Like

Ok then I assume the problem has something to do with the button, is there anything infront of the button blocking it like an invisible frame?

2 Likes

MouseButtonUp is when the button has been clicked and released. MouseButton1Click or MouseButtondown is your issue here. You must use either one.

1 Like

No actually, he can use MouseButton1Up, it fires when you release the left mouse button. In his case it doesn’t fire atall.

1 Like

I tried changing it to what you said, none of them worked.

No Gui or anything is blocking the button.

Make sure your script is enabled, and you might want to use WaitForChild as the local script is probably not picking up on it (on the button and storytext label).

Can you show the hierarchy of your ScreenGui? And an Image of your UI

Not sure if this will help your issue, but perhaps you do Page = 2, Page = 3, Page = 4 rather than Page += 1. It is more clean and makes things simple and I doubt it will help your issue, since it seems to be alright, but sometimes you can never be sure and it doesn’t hurt to try. It might be a GUI issue, as @ItzPlanes is suggesting.

1 Like

The localscript is inside of the button

I ment like a screenshot of it or something that shows the full hierarchy

1 Like

I’ll show you later I’m going on a walk rn, sorry.