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

How do I make script that checks if any player on the server have pressed a "textbutton" in a gui?

Asked by 4 years ago

Or a script that checks if a stringvalue has a value

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

How to check if stringValue has value:

stringValue = game.Workspace.StringValue

if(stringValue.Value ~= "")then 
       print("stringvalue object has a value of ".. stringValue.Value) 
end

alone, this'll only run when the server starts ^^^ but you can check the string's value every time the value changes by using the following event:

stringValue.Changed:Connect(function(newValue)
        print(newValue)
end)

Check if the button was clicked by saying the following:

myButton.MouseButton1Click:Connect(function()
      print("Button clicked")
end)

Ad

Answer this question