I was wondering if anyone could help me figure out why my script isn’t working. What I mean is the text in the text box wont change, every time i run my game the output doesn’t tell me any errors
local y = game.Workspace.Yes
local n = game.Workspace.No
local ask = script.Parent.SurfaceGui.Question.Text
y.ClickDetector.MouseClick:Connect(function()
script.Parent.SurfaceGui.Question.Text = "Ok, Lets Begin"
wait(5)
ask = "Are you relaxed"
n.ClickDetector.MouseClick:Connect(function()
ask = "Just relax"
or
y.ClickDetector.MouseClick:Connect(function()
ask = "Good"
end)
end)
end)
Even still I do not recommend making the code that way, but that bare code at least solves the problem you are having. In a full scale game I recommend coding it differently though.
I tried changing my script and maybe i should’ve made it clearer in my question, i meant to ask why wont the text in the text box change after 5 seconds
I don’t understand what you want to do, do you want to do this?
local Question = script.Parent.SurfaceGui.Question
local DefaultText=Question.Text
game.Workspace.Yes.ClickDetector.MouseClick:Connect(function()
if Question.Text=="Are you relaxed"then
Question.Text="Good"
wait(5)
Question.Text=DefaultText
elseif Question.Text==DefaultText then
Question.Text="Ok, Lets Begin"
wait(5)
Question.Text="Are you relaxed"
end
end)
game.Workspace.No.ClickDetector.MouseClick:Connect(function()
if Question.Text=="Are you relaxed"then
Question.Text="Just relax"
wait(5)
Question.Text=DefaultText
end
end)
edit:
Because twice adding a function to the same event will also just fire the previously added ones I guess