In case it isn't clearly apparent, I've never worked with TextBoxes before. It took me forever to figure out that I needed to use FocusLost instead of Changed, but now I'm running into a whole new can of worms--it doesn't want to connect the functions properly.
Apologies for pasting the ENTIRE script, but I GENUINELY have no idea what the problem is here, and it's only 39 lines.
sides = 6
numdice = 1
rolls = {}
SideInput = script.Parent.SideInput
NumInput = script.Parent.NumInput
RollDiceButton = script.Parent.RollIt
-----------------------------------------------------------------------
--Variable updaters
-----------------------------------------------------------------------
function changesides()
sides = SideInput.Text
end
function changenumberofdice()
numdice = NumInput.Text
end
-----------------------------------------------------------------------
--Dice rolling
-----------------------------------------------------------------------
function rollthedice()
math.randomseed(tick())
for i = 1, numdice do
table.insert(rolls, math.random(1,sides))
end
print(table.concat(rolls, ' '))
end
SideInput.FocusLost:connect(changesides())
NumInput.FocusLost:connect(changenumberofdice())
RollDiceButton.MouseButton1Down:connect(rollthedice())
Here's the error log I'm getting:
00:07:38.804 - Attempt to connect failed: Passed value is not a function 00:07:38.804 - Stack Begin 00:07:38.804 - Script 'Players.Player1.PlayerGui.ScreenGui.Frame.MasterScript', Line 35 00:07:38.805 - Stack End 00:07:38.805 - Attempt to connect failed: Passed value is not a function 00:07:38.805 - Stack Begin 00:07:38.805 - Script 'Players.Player1.PlayerGui.ScreenGui.Frame.MasterScript', Line 37 00:07:38.806 - Stack End 2 00:07:38.806 - Attempt to connect failed: Passed value is not a function 00:07:38.806 - Stack Begin 00:07:38.806 - Script 'Players.Player1.PlayerGui.ScreenGui.Frame.MasterScript', Line 39 00:07:38.807 - Stack End
Just going by the output, I'd guess that I must have accidentally created the functions incorrectly, or connected them wrong? I have no idea.
You may notice the random 2 in there, as well. This is genuinely the only script in the game, so my only guess is that this line:
print(table.concat(rolls, ' '))
is executing somehow, but then when I change the number of "dice" being "rolled", which should then change the size of the table by the time it's printed out, it still only returns one integer, and it's still always 2.
