-- Ui Location
local BarHeight = script.Parent
local PlayerUi = BarHeight.PlayerUi
PlayerUi.Visible = false
--Add ui function
local function AddUiOnChildAdded(Object)
if Object:IsA("Player") then
local Player = Object
local Character = Player.Character or Player.CharacterAdded:Wait()
--Ui
local ImageUi = PlayerUi:Clone()
ImageUi.Parent = BarHeight
ImageUi.Name = Player.Name
ImageUi.Visible = true
--Thumbnail
local ThumbnailType = Enum.ThumbnailType.AvatarBust
local ThumbnailSize = Enum.ThumbnailSize.Size420x420
local PlayerThumbnail, ImageLoaded = game.Players:GetUserThumbnailAsync(Player.UserId, ThumbnailType, ThumbnailSize)
if ImageLoaded then
ImageUi.Image = PlayerThumbnail
else
warn("Can't load Player's thumbnail reason is they might have a content deleted item description")
end
--Properties
local MaxHeight = 1000
local MinHeight = 0
local ScalePoint = 0.075
ImageUi.Size = UDim2.new(1, 0, ScalePoint, 0)
ImageUi.Position = UDim2.new(0, 0, ScalePoint, 0)
--Positioning
local function UiPosition()
local PlayerHeight = Character.HumanoidRootPart.Position.Y
local ScaleY = MinHeight - PlayerHeight / MaxHeight +1 - ScalePoint
ImageUi.Position = UDim2.new(0, 0, ScaleY, 0)
end
Character.Humanoid.FreeFalling:Connect(UiPosition)
Character.Humanoid.FallingDown:Connect(UiPosition)
end
end
--Connecting da function on all players
for _, Player in pairs(game.Players:GetPlayers()) do
AddUiOnChildAdded(Player)
end
--Updating
--Connecting da function on someone joins
game.Players.ChildAdded:Connect(AddUiOnChildAdded)
--Removing da player's ui on da player removed /quit
game.Players.ChildRemoved:Connect(function(Object)
if Object:IsA("Player") then
local Player = Object
BarHeight:FindFirstChild(Player.Name):Destroy()
end
end)```
-- Ui Location
local BarHeight = script.Parent
local PlayerUi = BarHeight.PlayerUi
PlayerUi.Visible = false
--Add ui function
local function AddUiOnChildAdded(Object)
if Object:IsA("Player") then
local Player = Object
local Character = Player.Character or Player.CharacterAdded:Wait()
--Ui
local ImageUi = PlayerUi:Clone()
ImageUi.Parent = BarHeight
ImageUi.Name = Player.Name
ImageUi.Visible = true
--Thumbnail
local ThumbnailType = Enum.ThumbnailType.AvatarBust
local ThumbnailSize = Enum.ThumbnailSize.Size420x420
local PlayerThumbnail, ImageLoaded = game.Players:GetUserThumbnailAsync(Player.UserId, ThumbnailType, ThumbnailSize)
if ImageLoaded then
ImageUi.Image = PlayerThumbnail
else
warn("Can't load Player's thumbnail reason is they might have a content deleted item description")
end
--Properties
local MaxDistanceX = 10 -- X position
local MinDistanceX = 0 -- X position
local ScalePoint = 0.05
ImageUi.Size = UDim2.new(ScalePoint, 0, 1, 0)
ImageUi.Position = UDim2.new(ScalePoint, 0, 1, 0)
--Positioning
Character.Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
local PlayerPositionX = Character.HumanoidRootPart.Position.X
local PositionX = MinDistanceX - PlayerPositionX / MaxDistanceX +1 -ScalePoint
ImageUi.Position = UDim2.new(PositionX, 0, 0, 0)
end)
end
end
--Connecting da function on all players
for _, Player in pairs(game.Players:GetPlayers()) do
AddUiOnChildAdded(Player)
end
--Updating
--Connecting da function on someone joins
game.Players.ChildAdded:Connect(AddUiOnChildAdded)
--Removing da player's ui on da player removed /quit
game.Players.ChildRemoved:Connect(function(Object)
if Object:IsA("Player") then
local Player = Object
BarHeight:FindFirstChild(Player.Name):Destroy()
end
end)