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

Why isn't the code changing its values?

Asked by 4 years ago

It isn't changing the values below. Also, for some reason, changing the value in the client doesn't do anything. I tried pretty much everything (Remote events). Any solution?

local db = false
local number = script.Parent.Parent.Parent.Parent.QuestionNumber.Value
local Value = script.Parent.Parent.Parent.Parent.QuestionNumberWordForm.Value
script.Parent.MouseButton1Click:Connect(function()
    if db == false then
        db = true
        script.Parent.Parent.Parent:TweenPosition(UDim2.new(-1.386, 0,0.356, 0), 'Out', 'Quad', 1)
        wait(1)
        if Value == "One" then
            Value = "Two"
            number = 2
        elseif Value == "Two" then
            Value = "Three"
            number = 3
        elseif Value == "Three" then
            Value = "Four"
            number = 4
        elseif Value == "Four" then
            Value = "Five"
            number = 5
        elseif Value == "Five" then
            Value = "Six"
            number = 6
        elseif Value == "Six" then
            Value = "Seven"
            number = 7
        elseif Value == "Seven" then
            Value = "Eight"
            number = 8
        end
        game.ReplicatedStorage.Remotes.FillValue:FireServer(Value, script.Parent.Parent.TextBox.Input.Text)
        if Value ~= "Eight" then
            script.Parent.Parent.Parent:TweenPosition(UDim2.new(0.386, 0,0.356, 0), 'In', 'Elastic', 2)
        else
            script.Parent.Parent.Parent.Parent.SubmitScreen:TweenPosition(UDim2.new(0.386, 0,0.356, 0), 'In', 'Elastic', 2)
        end
        db = false
    end
end)

1 answer

Log in to vote
0
Answered by 4 years ago

Sometime changing a string value to a string value may not work. So try doing this:

local Value = script.Parent.Parent.Parent.Parent.QuestionNumberWordForm --Get The value part

script.Parent.MouseButton1Click:Connect(function()
    if tostring(Value.Value) == "One" then --Check the value
        Value.Value = "Two" --Set the value
            number = 2
    end
end)

If that doesn't work, then just add a lot of print statements that print what they are doing

Ad

Answer this question