Hello. I’ve recently created a GUI in which somebody put’s a question in, and they click submit then it goes for voting for 30 seconds. After that the results are in and it’s meant to be however somebody can do another question, however whenever I try to click the submit button again it doesn’t work at all, I have to reset for it to work.
There doesn’t have to be an error for it to be causing unexpected behaviour. I can’t really help you based on the information you have given. Even your question isn’t that clear verbally speaking.
script.Parent.Submit.RoundedButton.TextButton.MouseButton1Click:connect(function()
if voteactive.Value == false then
if script.Parent.Input.TextBox.Text == "QUESTION HERE" or script.Parent.Input.TextBox.Text == "INPUT A QUESTION BEFORE STARTING" then
script.Parent.Input.TextBox.Text = "INPUT A QUESTION BEFORE STARTING"
script.Parent.Input.TextBox.PlaceholderColor3 = Color3.fromRGB(255, 3, 3)
wait(2)
script.Parent.Input.TextBox.PlaceholderColor3 = Color3.fromRGB(255, 255, 255)
script.Parent.Input.TextBox.Text = "QUESTION HERE"
else
if deb then return end
deb = true
local text = script.Parent.Input.TextBox.Text
VoteStart:FireServer(text)
local plr = game.Players.LocalPlayer
script.Parent:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Sine", 1.5)
end
end
end)
One thing: try to reduce the number of repeated references to script.Parent.Input.TextBox by storing it as a local variable instead and referring to that.
The reason why you aren’t able to click it again is because you never set the debounce variable back to false. Because it remains true, the GUI is unsubmittable, which is why resetting your character will restart the script, and the debounce is back to false again, enabling the ability to submit.
else
if deb then return end
deb = true
local text = script.Parent.Input.TextBox.Text
VoteStart:FireServer(text)
local plr = game.Players.LocalPlayer
script.Parent:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Sine", 1.5)
deb = false
end