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

How to lerp a block to your mouse position?

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

I tried to lerp the cube to my mouse position but it doesn't seem to work, why isn't it? attempt to call field 'Move' (a userdata value) Error I get

local m = game.Players.LocalPlayer:GetMouse()
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
    if wag < 0 then
      Parts[i].CFrame = Parts[i].CFrame:lerp(Parts[i - 1].CFrame * CFrame.Angles(-loudness / 8, -loudness / 6 , 0) * CFrame.new(0, 0, 0.15), 0.8)
    elseif wag > 0 then
        Parts[i].CFrame = Parts[i].CFrame:lerp(Parts[i - 1].CFrame * CFrame.Angles(-loudness / 8, loudness / 6 , 0) * CFrame.new(0, 0, 0.15), 0.8)
    end
  end
end
spawn(function()
    if m.Move() then
for i = 1, #SoundBlok do
    if i == 1 then
      SoundBlok[i].CFrame = SoundBlok[i].CFrame:lerp(m.Hit.p, 0.1)
    end
  end
for i = 1, #SoundBlok2 do
    if i == 1 then
      SoundBlok2[i].CFrame = SoundBlok2[i].CFrame:lerp(m.Hit.p, 0.1)
    end
  end
    end
end)
end)

the lerping code

spawn(function()
    if m.Move() then
for i = 1, #SoundBlok do
    if i == 1 then
      SoundBlok[i].CFrame = SoundBlok[i].CFrame:lerp(m.Hit.p, 0.1)
    end
  end
for i = 1, #SoundBlok2 do
    if i == 1 then
      SoundBlok2[i].CFrame = SoundBlok2[i].CFrame:lerp(m.Hit.p, 0.1)
    end
  end
    end
end)
end)

Answer this question