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

TweenPosition ? (Answered!)

Posted this in ROBLOX's SH forum, they all were like "Must be in a localscript" "Needs to be a localscript" "Localscript" "local", It IS in a LocalScript, they were driving me crazy.

The problem is a chat update function I made based off of a chat gui tutorial on wiki, it's fired everytime a player sends a message or there's a server message (still localscript)

local function Chat(Parent) 
for _,v in ipairs(Parent:GetChildren()) do if v.Name:sub(1,8)=="ChatLine" then 
local LineNumber=v.Name:sub(9) 
if LineNumber=="24" then v:Destroy() else 
v.Name="ChatLine"..tostring(tonumber(LineNumber)+1) v:TweenPosition(UDim2.new(0,0,1,v.Position.Y.Offset-14),"Out","Quad",.386,true)
end end end end

This would make call on all messages :Tweenpositon() Up 14. Yes, it works, but if you ever try to spam or chat at the same time another player chats then the message overlaps on another message. Override set to false or true don't help... Here's a pic of the result, I just hope SH lets me put it here.

Result pic

1 answer

✓ Accepted answer

What I think is happening is that the chat function is firing while some of the TextLabels are moving, so it Tweens them again, but to the wrong spots.

I suggest using explicitly defined vertical Offsets to Tween to, based on the line number, so even if it gets confused they should get Tweened to the correct spot.

2 comments

1

Interesting, never thought of this, like, based on the LineNumber like TweenPosition(UDim2.new(0,0,1,math.abs(14*LineNumber)),"Out","Quad",true)?

0

Exactly.

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