Mikzul
(mikzul)
January 17, 2022, 10:12pm
2
Try using lerp() and the distance between the two players, to stay in the middle of that distance. Using this you can also shift focus from one player to another.
In simple terms, lerp is used to get a point between two other points. For example say we had part1 and part2, we can position apart halfway between them using this.
local Part1 = --
local Part2 = --
local Part3 = Instance.new("Part", workspace)
Part3.CFrame = Part1.CFrame:Lerp(Part2.CFrame,0.5)
The second parameter (in this case 0.5, should be a number between 0 and 1. It is basically saying what percentage we want to lerp with.)
Here is another example of using Lerp. We loop through, starting at 0.1, and ending at 0.9, increasing by 0.1 each time. Then I create a new part each loop and position it that much between the two parts.
local Part1 = game.Workspace:WaitForChild("Part1")
local Part2 = game.Workspace:WaitForChild("Part2")
for i = 0.1, 0.9, 0.1 do
local Part = Instance.new("Part", workspace)
Part.Anchored= true
Part.CFrame = Part1.CFrame:Lerp(Part2.CFrame, i)
local Suface = script.SurfaceGui:Clone()
Sufac…
1 Like