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

TweenPosition ? (Answered!) [closed]

Asked by
Nymint 85
10 years ago

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

Locked by adark, TofuBytes, and Shawnyg

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
2
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

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.

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)? Nymint 85 — 10y
0
Exactly. adark 5487 — 10y
Ad