Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why did my textbutton script break suddenly?

Asked by 9 years ago

When I click this button, it doesn't do anything. It worked perfectly before, can you tell me why it won't work? FAQ: Q: Can you show the output? A: No, when I click Play Solo my studio crashes 9 out of 10 times.

Q: Are your hierarchies correct? A: Yes.

Q: Can you explain what this script is supposed to do? A: I have notes in the script that say what it should be doing.

Here is my LocalScript

wait(1)
player = game.Players.LocalPlayer
gui = player.PlayerGui.ScreenGui
adscreen = gui.adscreen
step2 = gui.Step2
results = gui.results
loading = gui.loading

script.Parent.MouseButton1Down:connect(function()-- The script's parent is a TextButton entitled 'Easy'
    adscreen.step2choice.Text = ("Easy")--There is a TextLabel in adscreen that is supposed to show your choice. This is changing the text to what you chose, which happens to be 'Easy'
    results.step2choice.Text = ("Easy")
    step2.Visible = false--the Step2 Frame
    adscreen.Visible =  true--the adscreen Frame
wait(5)
game:GetService("AdService"):ShowVideoAd() --Supposed to show the ad

game:GetService("AdService").VideoAdClosed:connect(function()-- when ad is closed, should close adscreen and open loading, another Gui
    adscreen.Visible = false
    loading.Visible = true
end)

if loading.Visible == false then
    adscreen.Visible = false
    loading.Visible = true
end
end)        

Answer this question