Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Script To Put A TextBox Text Into A Value Wont Work Why?

Hello,

I am trying to make so what a player buts in a textbox will come to a value but its not working You can find it on line; 3. script.Parent.mainFrame.Reward.MoneyToGet.Value = script.Parent.Bet.Bet.Text

Script,

script.Parent.Bet.Conrim.MouseButton1Click:Connect(function()
	script.Parent.mainFrame.Reward.MoneyToGet.Value = script.Parent.Bet.Bet.Text
	script.Parent.Bet.Visible = true
	local WinningColor = math.random(1,3)
	if WinningColor == 1 then
		for i = 1,3 do
			script.Parent.mainFrame.Green.BackgroundTransparency = 0.6
			script.Parent.mainFrame.Black.BackgroundTransparency = 0.6
			wait(.3)
			script.Parent.mainFrame.Red.BackgroundTransparency = 0.6
			script.Parent.mainFrame.Black.BackgroundTransparency = 0.6
			script.Parent.mainFrame.Green.BackgroundTransparency = 0
			wait(.3)
			script.Parent.mainFrame.Green.BackgroundTransparency = 0.6
			script.Parent.mainFrame.Red.BackgroundTransparency = 0.6
			script.Parent.mainFrame.Black.BackgroundTransparency = 0
			wait(.3)
			script.Parent.mainFrame.Green.BackgroundTransparency = 0.6
			script.Parent.mainFrame.Black.BackgroundTransparency = 0.6
			script.Parent.mainFrame.Red.BackgroundTransparency = 0
			wait(.3)
			end
	    end

2 answers

###If MoneyToGet is an IntValue or a NumberValue, this will not work. You'll need to tonumber the Text.


script.Parent.Bet.Conrim.MouseButton1Click:Connect(function()
    local success, msg = pcall(function() 
        script.Parent.mainFrame.Reward.MoneyToGet.Value = tonumber(script.Parent.Bet.Bet.Text)
    end) 
end)

I agree with incapaz, only StringValues can save Texts

This discussion is preserved as it was. New answers, comments, and votes are closed.