I’m trying to get a dot to tween to a player’s X position, but also max out after a certain distance. For example, the dot’s max coordinates will be X -200 to X 200. If the player’s X coordinate is within this range, the dot will tween across the screen in a progress-bar like fashion. If they are outside this coordinate range, the dot will max out before the end of the screen.
Here is a video example of what I mean:
Here is my code so far:
local dot = script.Parent
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local pos = UDim2.new(player.Name.humanoidRootPart.Position, 0, 0.05, 0)
while humanoidRootPart do
dot:TweenPosition(pos)
wait(0.1)
end
end)
end)