On there he said he resolved the issue, but never said how. I’m trying to make a dialogue with options and I don’t want to take up many lines for an unspecified amount of options, which are in a for loop.
Make variables for them all and seperate functions or loop all of the variables and when you click them, perform the action if they are supposed to perform the same action.
Find the button thru table.find() or a loop from the table then. Oh, wait. Just loop the table and when the buttons are clicked perform the function if you want to perform the same function. (only if u want all buttons doing the same)
local optionClicked
for _, v in pairs(options) do
v.MouseButton1Up:Wait()
optionClicked = v
break
end
if optionClicked:FindFirstChild('ContinueDialogue') then
-- Continue dialogue
end
First few tries I had errors. I fixed them, but now it only does the function with only one button.
local optionClicked
local options = script.Parent:GetChildren()
while wait() do
for _, v in pairs(options) do
if v ~= script then
v.MouseButton1Up:Wait()
print('YES')
optionClicked = v
break
end
break
end
end
if optionClicked:FindFirstChild('ContinueDialogue') then
print("This doesn't print :(")
end
Check my idea above, do you have Discord? I can help you with this, I know what you are want from the script. Did you try that script with other buttons too?
for _,part in pairs(script.Parent.Frame:GetChildren()) do
if part:IsA('TextButton') then
part.MouseButton1Click:Connect(function()
--perform checks etc and then call their functions
end)
end
end