I know this is a common question. But when I try it in studio, the TextButton works. In client however, nothing...
ap = require(script.Parent.Parent.TrelloAPI) local Board = ap:GetBoardID("Admittance") local List = ap:GetListID("Admitted",Board) script.Parent.MouseButton1Click:connect(function() if game.Players:FindFirstChild(script.Parent.Parent.Patient.Text) == nil then script.Parent.Text = "Please enter a valid name" wait(2) script.Parent.Text = "Send report" else if script.Parent.Parent.Reason.Text == "" then script.Parent.Text = "Please enter a valid reason" wait(2) script.Parent.Text = "Send report" else script.Parent.Text = "Submitted" wait(5) script.Parent.Parent.Parent.Admit.Visible = false script.Parent.Parent.Parent.Button.Visible = true ap:AddCard(script.Parent.Parent.Patient.Text,script.Parent.Parent.Reason.Text,List,"","top") end end end)
You had a mix of if's and else's in there, so I cleaned it all up..(Might have been the problem) Plus I made the AddCard Event a variable!
Script:
ap = require(script.Parent.Parent.TrelloAPI) local Board = ap:GetBoardID("Admittance") local List = ap:GetListID("Admitted",Board) local debounce = false -- just so they dont spam click the submit button script.Parent.MouseButton1Click:connect(function() -- button connection if debounce == false then -- click filter debounce = true local check = game.Players:FindFirstChild(script.Parent.Parent.Patient.Text) if check == nil then -- checks if nil script.Parent.Text = "Please enter a valid name" wait(2) script.Parent.Text = "Send report" elseif script.Parent.Parent.Reason.Text == "" then script.Parent.Text = "Please enter a valid reason" wait(2) script.Parent.Text = "Send report" else script.Parent.Text = "Submitted" wait(5) script.Parent.Parent.Parent.Admit.Visible = false script.Parent.Parent.Parent.Button.Visible = true local card = ap:AddCard(script.Parent.Parent.Patient.Text,script.Parent.Parent.Reason.Text,List,"","top") end debounce = false end end)
Hope this works!