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

How am I adding one string to another wrong? (question updated to be more detailed)

Asked by 8 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

This is for a password thingy. I have a part with a surface gui that is supposed to display the password once entered. I also have a string value in the button(s) which once pressed should add the string value to the surface gui's textbox's text while still including previous text. It does nothing. The important part is lines 18 - 20 because those parts are the parts not working.

Full script:

U = script.Parent.CodeKey.SurfaceGui.TextBox.Value

for i, v in pairs(script.Parent:GetChildren()) do
    if v:FindFirstChild('ClickDetector') then   
        v.ClickDetector.MouseClick:connect(function()
            v.Ok.Value = v.Ok.Value+1
            if v.ClassName == "Part" and v.Name == "Button" then
                print(v.Ok.Value)
                if v.Ok.Value == 1 then
                    v.Ok.Value = v.Ok.Value-1
                    v.Size = v.Size-Vector3.new(0, 0, .2)
                    v.Position = v.Position-Vector3.new(0, 0, .1)
                    wait(.03)
                    v.BrickColor = BrickColor.new(1022)
                    wait(.05)
                    v.Size = v.Size+Vector3.new(0, 0, .2)
                    v.Position = v.Position+Vector3.new(0, 0, .1)
                    if v:FindFirstChild('value') then
                        script.Parent.CodeKey.SurfaceGui.TextBox.Text = script.Parent.CodeKey.SurfaceGui.TextBox.Text .. v.Value.Value 
                        print(script.Parent.CodeKey.SurfaceGui.TextBox.Text)
                    end
                    wait(.02)
                    if v.Typ.Value == 1 then
                        v.BrickColor = BrickColor.new(194)
                    end
                    if v.Typ.Value == 2 then
                        v.BrickColor = BrickColor.new(327)
                    end
                    if v.Typ.Value == 3 then
                        v.BrickColor = BrickColor.new(310)
                    end
                end     
            end
        end)
    end
end

part that doesn't work:

if v:FindFirstChild('value') then
                        script.Parent.CodeKey.SurfaceGui.TextBox.Text = script.Parent.CodeKey.SurfaceGui.TextBox.Text .. v.Value.Value 
                        print(script.Parent.CodeKey.SurfaceGui.TextBox.Text)
                    end
1
What "doesn't work"? What does it do instead? Is there an error? Is there other debugging output (does that `print` print anything?) BlueTaslem 18071 — 8y
0
On line two of the second code block, you put at the end .. v.Value.Value when I think you mean v.value.Value. Lua is VERY case sensitive. User#11440 120 — 8y

Answer this question