Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Lerping a line of blocks connected to torso to your mouse position?

Asked by
816i 19
7 years ago
Edited 7 years ago

This is mainly for Goulstem because Im having a ton of trouble with this code

game:GetService("RunService").RenderStepped:connect(function()
  for i = 1, #Parts do
    if i == 1 then
      Parts[i].CFrame = Parts[i].CFrame:lerp(game.Players.LocalPlayer.Character.Torso.CFrame-Vector3.new(0,.75,0), 0.9)
    else
      Parts[i].CFrame = Parts[i].CFrame:lerp(Parts[i - 1].CFrame * CFrame.Angles(-loudness / 5, math.sin(-loudness / 1000000000), 0) * CFrame.new(0, 0, 0.15), 0.8)
    end
  end
end)
 local plr = game.Players.LocalPlayer
local m = plr:GetMouse()
local parts --This is your model of the parts.
repeat wait() until plr.Character
local char = plr.Character
local tor = char:WaitForChild("Torso")
local offset = CFrame.Angles(-loudness / 10, math.sin(-loudness / 1000000000), 0) * CFrame.new(0, 0, 0.15)
function visualize()
    for i = 1, #Parts2 do
        if i == 1 then
                Parts2[i].CFrame = Parts2[i].CFrame:lerp(
                    tor.CFrame+Vector3.new(0,.75,0),
                    0.9
                 )
        else
            Parts2[i].CFrame = Parts2[i].CFrame:lerp(
                Parts2[i - 1].CFrame * offset * CFrame.new(0, 0, 0.15), 
                0.8
            )
        end
    end
end
m.MouseMoved:Connect(function()
    local spot = m.Hit;
    parts:SetPrimaryPartCFrame(CFrame.new(tor.Position,m.Hit.p))
end)
while wait(.1) do
    visualize()
end

That is the full lerping and stuff scripts with both parts, I cant seem to tell whats wrong there. The longer one is the one thats having a problem but because of the longer one, the small one also doesn't work

EDIT: This is better than the last ver. just an error

for i = 1, 300 do
  local p = Instance.new("Part", game.Players.LocalPlayer.Character.Torso)
  p.Size = Vector3.new(0.2, 0.2, 0.2)
  p.Anchored = true
  p.CanCollide = false
  p.Material = "Neon"
  p.Position = game.Players.LocalPlayer.Character.Torso.Position
  table.insert(Parts2, p)
end

The part that makes the line of blocks

Answer this question