Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)
Ad
Log in to vote
0
Answered by 5 years ago

I agree with incapaz, only StringValues can save Texts

Answer this question