This is a script of what I'm trying to do;
local plr = game.Players.LocalPlayer local Continue = plr:WaitForChild("Stats").Continue local NB = script.Parent NB.MouseButton1Down:connect(function() if Continue.Value == true then local WTS = script.Parent.Parent:WaitForChild("TextBubble").WhatToSay local Arrow = script.Parent.Parent.Parent:WaitForChild("MainFrame").Arrow --Animating the Arrow Arrow:TweenPosition(UDim2.new(0, 130,0, 160),'In','Sine',3) WTS.Value = "" wait() WTS.Value = "First, let's take a look at the Income bar! The Income bar show's how much Coins you get per the amount of time. You can upgrade the time stat in the shop. Upgrading it will just decrease the time." NB.MouseButton1Down:connect(function() WTS.Value = "Hey, why don't we play an obby? We might win some rare rewards!" end) end end)
The problem is if I click the button one time it will repeat, What I'm trying to do is The first time the player clicks the NB button it will change WTS.Value to "First, let's take a look at the Income bar! The Income bar show's how much Coins you get per the amount of time. You can upgrade the time stat in the shop. Upgrading it will just decrease the time."
Then when the player clicks the NB Button again it will change the value. Though right now if you take a look it is pretty obvious that When I click the NB Button 1 time it will run both codes. How would I fix this? Any advice or tips are appreciated. Thanks
Hey BlackOrange3343,
--[[ Store all of the text inside of a table. (Make sure it's in order of what you want to come first and what you want next. Set a variable equal to 1 and add 1 to it every time the player clicks. Index through the table using that variable. --]]
local texts = { "Hey, how are you doing today?", "I'm doing fine, how about you?" } local button = script.Parent local i = 1 button.MouseButton1Down:Connect(function() local text = texts[i]; button.Text = text i = i + 1 end)
~~ KingLoneCat