I'm making a GUI that is supposed to let you "breed" two animal AI, but I don't know how to tell the script to occur only when the two boxes (already created and named) are selected and the "Breed" button is clicked. I've tried to look at some other scripts to see how this is done for selecting one button, but I can't figure it out, especially for two separate buttons. I included my script below, and I am aware that it is incomplete and messy currently. Also some of the variables I have here may not make sense yet because I need them for stuff I'm gonna add in the future. Basically to clarify my question is, how can I signify that BOTH of the buttons are selected and the "Breed" button is clicked? Thanks for any and all help guys!!!
local BUTTON = script.Parent local TOOL = script.Parent local NAME1 = "Bull" local NAME2 = "Cow" local DEEDS = game.Lighting.Animals local DEED1 = DEEDS:findFirstChild(NAME1) local DEED2 = DEEDS:findFirstChild(NAME2) local AFRAME = script.Parent.Parent.Parent local NEWBUTTON = AFRAME.newButton --not sure if i need multiple functions, maybe one for recognizing the two buttons being selected --and one for the "Breed" button being selected? function on_button1_down() NEWBUTTON.MouseButton1Down:connect(function() local current = NEWBUTTON end) end ---------------------------------
If you want to have it so when both buttons are pressed it fires, it should look something like this.
created = false name = false function click () if name and created then --Action would be here end end SCRIPT.MouseButton1Down:connect(click)
So created and name would be connect to a function, Say when the players types his name and presses "Enter". You would set created or name to true. If this didn't help you I apologize as I may have thought your question meant something different.
So OpticalAce would this work as a base to work off of?
local BUTTON = script.Parent local TOOL = script.Parent local NAME1 = "Bull" local NAME2 = "Cow" local DEEDS = game.Lighting.Animals local DEED1 = DEEDS:findFirstChild(NAME1) local DEED2 = DEEDS:findFirstChild(NAME2) local AFRAME = script.Parent.Parent.Parent local NEWBUTTON = AFRAME.newButton created = false name = false function click () if name and created then created = true name = true function onMouseButton1Down() print("complete") end end BUTTON.MouseButton1Down:connect(click) BUTTON.MouseButton1Down:connect(on_button1_down)