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

Button script fails to operate in a server script, can you please help me?

Asked by 5 years ago

I have tried multiple solutions which all fail, I want to be able to click a button in a server script not a local one. I know its POSSIBLE because I have done this multiple times before but for some reason today it just does not want to work, I don't even get any errors.

Setup = script.Parent.Base.Setup
ContinueButton = script.Parent.Base.Setup.Continue

ContinueButton.MouseButton1Down:Connect(function()
    Setup.Visible = false
end)

1 answer

Log in to vote
-1
Answered by
ryan32t 306 Moderation Voter
5 years ago

Yes. It is possible. I don't see any problems with your script. Try adding a "wait()". I used this Script in ServerScriptService for a Gui TextButton. I added "wait(3)" to the beginning because it wouldn't work if i didn't add it

Script:

wait(3)
for _,v in pairs(game.Players:GetDescendants()) do
    if v:IsA"TextButton" then
        v.MouseButton1Down:Connect(function()
            print("button clicked")
        end)
    end
end
Ad

Answer this question