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

How would I format this string?

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?

1 comment

0

Why not use 'V' and '^' ?

1 answer

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

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