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

:TweenPosition instead of just Position?

Asked by 8 years ago
Edited 8 years ago
--\\ Services
local ReplicatedStorage = game:GetService'ReplicatedStorage'
--\\Nicknames and Tables
local ply = script.Parent.Parent or game.Players.LocalPlayer
local Event = ReplicatedStorage.ChatEvent
local Messages = {}
--\\ Functions
local function TweenPushMessages(Size)
    for i,v in pairs (Messages) do
        v.Position = v.Position - UDim2.new(0,0,0,Size)
    end
end
--\\FireServerFunction
ply.Chatted:connect(function(msg)
    if msg ~= '' then
        Event:FireServer(msg)
    elseif msg == '' then
        return
    end
end)
Event.OnClientEvent:connect(function(ply,msg)
local MSG = script.Messages_:Clone()
            MSG.Message.Text = msg
            MSG.Message_Owner.Text = '['..ply.Name..']: '
            MSG.Parent = ply.PlayerGui.ChatGui.Frame
            MSG.Message_Owner.TextColor3 = ply.TeamColor.Color
            TweenPushMessages(MSG.AbsoluteSize.Y)
            Messages[#Messages+1] = MSG
end)

The function TweenPushMessages is where I'm trying to do it, but I know it wouldn't work, would there be a way to recreate it with TweenPosition instead?

1 answer

Log in to vote
1
Answered by
KarlXYZ 120
8 years ago
Edited 8 years ago
local function TweenPushMessages(Size)
for i,v in pairs (Messages) do
        v:TweenPosition(v.Position - UDim2.new(0,0,0,Size), "Out", "Quad", 0.5)
    end
end

Replace the 0.5 with the duration of the tween.

You can also try different easing styles too.

Ad

Answer this question