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

How would I format this string?

Asked by 10 years ago

Alrighty, so I've got a script that moves a toolbar onto and off of the screen at the click of a button. It operates on the y-axis, so naturally I'd like a little arrow to see which way the bar will go when clicked. If only it were so simple. Here's the code, I'll explain what happens after it:

local down = false

script.Parent.MouseButton1Click:connect(function()
    if not down then
        script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 1, 0), "Out", "Quad", 0.75)
        wait(0.75)
        script.Parent.Text = "\/"
        down = true
    elseif down == true then
        script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0.8, 0), "Out", "Quad", 0.75)
        wait(0.75)
        script.Parent.Text = string.reverse("\/")
        down = false
    end 
end)

The problem begins on line 12. An "unfinished string" error is thrown, and I have no idea how to properly format it so I get /\ and \/. Line 12 is a result of my struggle. Any knowledge out there to help?

0
Why not use 'V' and '^' ? TheGuyWithAShortName 673 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Try print(string.reverse("\\/"))

Ad

Answer this question