Hello Devs,
Whenever a player moves or jumps how would i make a textlabel that displays that the “Players Name” and fades after 5 seconds but if another player has moved within the 5 seconds fade time a replica of the textlabel with the player who moved this time is displayed underneath the original one then after 5 seconds it fades, kinda like a list system. Its quite to hard to explain but when the old one has faded the new one then moves up.
Ive tried this script it dosent work well at all:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TimerEvent = ReplicatedStorage:WaitForChild("TimerEvent")
local function moveTextLabelToPosition(textLabel)
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local endPosition = UDim2.new(0.497, 0,0.029, 0)
local tweenProperties = {
Position = endPosition,
}
local tween = tweenService:Create(textLabel, tweenInfo, tweenProperties)
tween:Play()
tween.Completed:Connect(function()
textLabel.Position = UDim2.new(0.497, 0,0.029, 0)
textLabel.TextTransparency = 0
end)
end
local moveDirectionFlags = {}
local function fadeOutTextLabel(textLabel)
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local endTransparency = 1
local tweenProperties = {
TextTransparency = endTransparency
}
local tween = tweenService:Create(textLabel, tweenInfo, tweenProperties)
tween:Play()
tween.Completed:Connect(function()
textLabel.TextTransparency = 0
textLabel.Text = ""
end)
end
local function onMove(player)
if not moveDirectionFlags[player] then
moveDirectionFlags[player] = true
local message = player.Name .. " has moved :("
TimerEvent:FireAllClients(player)
local moveNameGui = player.PlayerGui:FindFirstChild("PlayerMovedGui")
if moveNameGui then
local textLabel = moveNameGui.PlayerMove.PlayerMoved
if textLabel then
textLabel.Text = message
moveTextLabelToPosition(textLabel)
wait(2)
fadeOutTextLabel(textLabel)
moveDirectionFlags[player] = false
end
end
end
end
for _, player in ipairs(game.Players:GetPlayers()) do
player.CharacterAdded:Connect(function(character)
local hum = character:WaitForChild("Humanoid")
hum:GetPropertyChangedSignal("MoveDirection"):Connect(function()
onMove(player)
end)
end)
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hum = character:WaitForChild("Humanoid")
hum:GetPropertyChangedSignal("MoveDirection"):Connect(function()
onMove(player)
end)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
moveDirectionFlags[player] = nil
end)
Please help ive been trying this for hours, Thanks!
