I'm attempting to make a gui that shows different sets of tips that are sectioned off and are chosen based on the players choice. The gui seems to be functioning well, the button for opening up the thing works well, the section opens the respective tips, but when I close out of one section and decide to click on the other section, when I click the button that takes me to the next page or that takes me back, the display may show the text that is stored from the other dictionary.
I'm pretty sure the problem is that when I switch to the other section, the previous function is still active since the output shows the Page number/All pages ratio (Line 100/118)print("Next "..Page.."/"..#TypeOfHelp)for both section selected. Is it possible to shut down one function, preferably via the exit button function (Line 91)
ExitButton.MouseButton1Down:Connect(function()
Exit = true print(Exit)
end),
to stop conflicting actions?
Local Script:
HelpGui = script.Parent.Parent
TutorialGui = script.Parent
DecisionGui = HelpGui.DecisionScreen
Open = false
KillerHelp = {
[1] = "The killer will receive an axe to kill anyone that is found. Only 15 minutes are given to hunt down everyone. When chasing a person, it\
is important to know that you are slower than the survivors, though there are powers that will help make up for that setback.",
[2] = "Sense - You will be able to go into 3rd person for 10 seconds, allowing you to stalk without the risk of being spotted.",
[3] = "Reform - A map will appear with blue spots that can be clicked on. You will be teleported to the spot.",
[4] = "Spirit Walk - You become invisible for 5 seconds and have your speed tremendously increased. You may press the sprint to slow back down\
to running speed.",
[5] = "Sense - You will be able to go into 3rd person for 10 seconds, allowing you to stalk without the risk of being spotted.",
[6] = "Reform - A map will appear with blue spots that can be clicked on. You will be teleported to the spot."
}
SurvivorHelp = {
[1] = "Your role as a survivor will have you survive a roaming killer until a 15 minute timer runs out. Run and hide from the murderer as he\
chases you.",
[2] = "You will be given a flashlight that will make it easier to traverse the map. When using the flashlight you are more susceptible to be\
caught, during chase when you are already spotted, this will not matter as much.",
[3] = "It is useful to know that the killer is slower than you. Despite that, the one chasing you has access to powers that can aid them and\
make up for their sluggish speed.",
}
RInt = script.R
GInt = script.G
BInt = script.B
Next = DecisionGui.Next
Back = DecisionGui.Back
KillerBox = DecisionGui.Killer
SurvivorBox = DecisionGui.Survivor
ExitButton = DecisionGui.ExitButton
Event = game.ReplicatedStorage.TutorialEvent
local Exit = false
Event.OnClientEvent:Connect(function(Status)
TutorialGui.Visible = false
if Status == 'Off' then
DecisionGui.Visible = false
for i,v in pairs(DecisionGui:GetChildren()) do
v.Visible = false
end
end
end)
function RGBChange(R,G,B)
RInt.Value = R
GInt.Value = G
BInt.Value = B
end
TutorialGui.MouseButton1Down:connect(function()
--Open Shop
print(TutorialGui.Name.. "Clicked")
if Open == false then
print("Open == false")
DecisionGui.Visible = true
for i, TextBox in pairs(DecisionGui:GetChildren()) do
print("Going through".. DecisionGui.Name)
if TextBox.ClassName == 'TextBox' then
TextBox.Visible = true
Open = true
end
end
Open = true
elseif Open == true then
print("Open == true")
DecisionGui.Visible = false
Open = false
end
end)
SectionOpen = false
function SetionOpener(TextBox, TypeOfHelp, BaseColorR, BaseColorG, BaseColorB)
--Open Section
print(Exit)
local HelpDisplayer = DecisionGui.HelpDisplayer
if Exit ~= true then
print(TextBox.Name.. "Clicked")
local Help = TypeOfHelp
local MaxPage = #TypeOfHelp
if SectionOpen == false then
local Exit = false
print("SectionOpen == false")
HelpDisplayer.Visible = true
Next.Visible = true
Back.Visible = true
HelpDisplayer.Text = TypeOfHelp[1]
local Page = 1
RGBChange(BaseColorR, BaseColorG, BaseColorB)
ExitButton.Visible = true
local Exit = false
ExitButton.MouseButton1Down:Connect(function()
Exit = true
print(Exit)
end)
Next.MouseButton1Down:Connect(function()
local TypeOfHelp = TypeOfHelp
local MaxPage = #TypeOfHelp
if Page < MaxPage and TypeOfHelp == Help then
Page = Page + 1
print("Next "..Page.."/"..#TypeOfHelp)
--Killer
HelpDisplayer.Text = TypeOfHelp[Page]
if TypeOfHelp == KillerHelp then
GInt.Value = GInt.Value - 10
BInt.Value = BInt.Value - 10
--Survivor
elseif TypeOfHelp == SurvivorHelp then
RInt.Value = RInt.Value - 10
BInt.Value = BInt.Value - 10
end
end
end)
Back.MouseButton1Down:Connect(function()
local TypeOfHelp = TypeOfHelp
local MaxPage = #TypeOfHelp
if (Page - 1) > 0 and TypeOfHelp == Help then
Page = Page - 1
print("Back "..Page.."/"..MaxPage)
HelpDisplayer.Text = TypeOfHelp[Page]
--Killer
if TypeOfHelp == KillerHelp then
GInt.Value = GInt.Value + 10
BInt.Value = BInt.Value + 10
--Survivor
elseif TypeOfHelp == SurvivorHelp then
GInt.Value = GInt.Value + 10
BInt.Value = BInt.Value + 10
end
end
end)
end
else
end
end
--Activate SectionOpener
KillerBox.MouseButton1Down:Connect(function()
SectionOpener(KillerBox, KillerHelp, 255, 100, 100)
end)
SurvivorBox.MouseButton1Down:Connect(function()
SectionOpener(SurvivorBox,SurvivorHelp, 100, 255, 100)
end)
