How can I make this dot tween left to right based on player position (video example included)

Uh, i tried to stop that, but i don’t know how, i will try to fix it know.

Here! I fixed it! Go and open this Local Script…
image
and paste in this code:

local distance = (workspace.StartPart.Position - workspace.EndPart.Position).Magnitude
while wait() do
	local pos = game.Players.LocalPlayer:DistanceFromCharacter(game.Workspace.StartPart.Position)
	local pos2 = game.Players.LocalPlayer:DistanceFromCharacter(game.Workspace.EndPart.Position)
	if pos/distance>1 then
		script.Parent.Position = UDim2.new(1,0,0,0)
	elseif pos/distance<0.05 then
		script.Parent.Position = UDim2.new(0.05,0,0,0)
	elseif pos2<distance then
		script.Parent.Position = UDim2.new(pos/distance,0,0,0)
	end
end
2 Likes

This is fantastic.

1 Like