Hello! I'm making a Sliding GUI Text that will be synced with my website. However, the problem is, is that obviously because when there is a lot of text, the text is positioned somewhere else or it cuts off part of it. Is there a way to fix that? Currently I have this:
place = "Place1"
function explode(str, separator, withpattern) -- credit: https://code.google.com/p/divranspack/source/browse/trunk/+divranspack/Non+Gmod+Things/Minecraft+Lua+Server/luadriver/string.lua?r=475
if separator == "" then
local ret = {}
for i=1,#str do
ret[i] = string.sub(str,i,i)
end
return ret
end
local ret = {}
local index,lastPosition = 1,1
if not withpattern then separator = string.gsub( separator, "[%-%^%$%(%)%%%.%[%]%*%+%?]", "%%%1" ) end
for startPosition,endPosition in string.gmatch( str, "()" .. separator.."()" ) do
ret[index] = string.sub( str, lastPosition, startPosition-1)
index = index + 1
lastPosition = endPosition
end
ret[index] = string.sub( str, lastPosition)
return ret
end
pages = {}
curpage = ""
curpagen = 0
prevsav = ""
coroutine.resume(coroutine.create(function()
while true do
local sav = game:GetService("HttpService"):GetAsync("http://www.mxmcube.net/billy/news/news.php",true)
if sav ~= prevsav then
prevsav = sav
local pages2 = explode(sav,"(;break;)")
if #pages2 >= 1 then
for i,_ in pairs(pages) do
table.remove(pages,i)
end
for _,v in pairs(pages2) do
local one,x = string.gsub(v,"%%player%%",script.Parent.Parent.Parent.Parent.Parent.Name)
local two,x = string.gsub(one,"%%place%%",place)
table.insert(pages,two)
end
else
for i,_ in pairs(pages) do
table.remove(pages,i)
end
table.insert(pages,sav)
end
curpagen = 1
curpage = pages[1]
end
wait(4)
end
end))
repeat wait() until #pages >= 1
coroutine.resume(coroutine.create(function()
script.Parent.TextLabel.Size = UDim2.new(0,1,1,0)
script.Parent.TextLabel.Position = UDim2.new(tonumber("1."..string.len(script.Parent.TextLabel.Text).."")/2,0,0,0) -- problem here
script.Parent.TextLabel.TextTransparency = i
script.Parent.TextLabel.TextStrokeTransparency = i
while true do
curpagen = curpagen + 1
if curpagen > #pages then
curpagen = 1
end
curpage = pages[curpagen]
script.Parent.TextLabel.Text = curpage
script.Parent.TextLabel.Size = UDim2.new(0,1,1,0)
local ting = tonumber("1."..(string.len(script.Parent.TextLabel.Text)/2).."") -- problem here
print(ting,reps)
script.Parent.TextLabel.Position = UDim2.new(ting,0,0,0)
script.Parent.TextLabel:TweenPosition(UDim2.new(0,0,0,0),"Out","Linear",30,false,nil) -- problem here
coroutine.resume(coroutine.create(function()
for i=1,0,-0.1 do
script.Parent.TextLabel.TextTransparency = i
script.Parent.TextLabel.TextStrokeTransparency = i
wait(0.1)
end
end))
wait(29)
for i=0,1,0.1 do
script.Parent.TextLabel.TextTransparency = i
script.Parent.TextLabel.TextStrokeTransparency = i
wait(0.1)
end
end
end))
Does anyone know something like a mathematical formulae for a sliding text GUI that is properly positioned? Thank you.
