Basically I’m trying to make it to where you press either the Yes or No TextButton, some specific properties will change. But my code does not seem to work and I don’t know why. I am trying to learn scripting and this is my first attempt at doing so. Any help would be cool.
Trying to make the MainLabel say something different when you press the Yes Button or No button. I want the MainLabel to say something different if you press the Yes button and something different if you press the No button. Is there a better way to do this?
I’ve updated the code but it still doesn’t work:
local Frame = game.StarterGui.ScreenGui.MainFrame
local No = script.Parent.No
local Yes = script.Parent.Yes
local MainLabel = script.Parent.MainLabel
local NoOne = script.Parent.NoOne
local YesOne = script.Parent.YesOne
MainLabel.Text = "Let's Begin. Are You Nervous?"
Yes.MouseButton1Click:Connect(function(player)
MainLabel.Text = "You Should Be. Are You Afraid Of The Dark?"
No.Visible = false
NoOne.Visible = true
Yes.Visible = false
YesOne.Visible = true
No.MouseButton1Click:Connect(function(player)
MainLabel.Text = "How Interesting. I'm Sure Your Answer Will Soon Change. Are You Afraid Of The Dark"
Yes.Visible = false
YesOne.Visible = true
No.Visible = false
NoOne.Visible = true
end)
end)
And like I said, I’m trying to change the MainLabel when you press the Yes or No buttons. The MainLabel says something different if you press the Yes button and it says something different when you press the No button. I made it where if you press the Yes or No button the Yes and No buttons are not visible anymore and two new buttons are now visible and take their place. Is there a better way to accomplish my goal?
local Frame = game.StarterGui.ScreenGui.MainFrame
local No = script.Parent.No
local Yes = script.Parent.Yes
local MainLabel = script.Parent.MainLabel
local NoOne = script.Parent.NoOne
local YesOne = script.Parent.YesOne
MainLabel.Text = "Let's Begin. Are You Nervous?"
Yes.MouseButton1Click:Connect(function(player)
MainLabel.Text = "You Should Be. Are You Afraid Of The Dark?"
No.Visible = false
NoOne.Visible = true
Yes.Visible = false
YesOne.Visible = true
end)
No.MouseButton1Click:Connect(function(player)
MainLabel.Text = "How Interesting. I'm Sure Your Answer Will Soon Change. Are You Afraid Of The Dark"
Yes.Visible = false
YesOne.Visible = true
No.Visible = false
NoOne.Visible = true
end)
It still doesn’t work, and I have “player” inside of the function because I looked at another script as a reference. I’m new at scripting so I don’t really know any better lol. At least I now know that I don’t need to put anything inside of the function and that I can just leave it blank.
I’m trying to make it where you press the Yes or No button the MainLabel text changes. I want the MainLabel to say something different if you press the Yes button and something different if you press the No button. Nothing is happening when I press the buttons.
It’s alright! It seems as you forgot to make the MainLabel visible when clicking the Yes button and No button. Try the following code and let me know how it goes:
local Frame = script.Parent
local No = script.Parent.No
local Yes = script.Parent.Yes
local MainLabel = script.Parent.MainLabel
local NoOne = script.Parent.NoOne
local YesOne = script.Parent.YesOne
local ImageLabelYes = script.Parent.Yes.ImageLabel
local ImageLabelYesOne = script.Parent.YesOne.ImageLabel
local ImageLabelNo = script.Parent.No.ImageLabel
local ImageLabelNoOne = script.Parent.NoOne.ImageLabel
Yes.MouseButton1Click:Connect(function()
MainLabel.Text = ("You Should Be. Are You Afraid Of The Dark?")
MainLabel.Visible=true
No.Visible= false
NoOne.Visible= true
ImageLabelNo.Visible= false
ImageLabelNoOne.Visible= true
Yes.Active = false
YesOne.Visible= true
ImageLabelYes.Visible= false
ImageLabelYesOne.Visible= true
No.MouseButton1Click:Connect(function()
MainLabel.Text = ("How Interesting. I'm Sure Your Answer Will Soon Change. Are You Afraid Of The Dark")
MainLabel.Visible=true
Yes.Visible= false
YesOne.Visible= true
ImageLabelYes.Visible= false
ImageLabelYesOne.Visible= true
No.Visible= false
NoOne.Visible= true
ImageLabelNo.Visible= false
ImageLabelNoOne.Visible= true
end)
end)
Still doesn’t work. The MainLabel is already visible anyway. Is there an easier or different way to achieve what I’m trying to achieve? I feel very bummed out that I can’t script something simple like this.
Would you mind giving me the .rbxl place file for the game? I’ll try to search for the problem and give you a fix for it. You can do so by going up to File > Save to File as… then send it here. Thanks!