so Im trying to lerp a block to my current mouse position but I receive the error Attempt to connect failed: Passed value is not a function at the if m.Move:connect() then.
spawn(function()
local m = game.Players.LocalPlayer:GetMouse()
if m.Move:Connect() then
for i = 1, #SoundBlok do
if i == 1 then
SoundBlok[i].CFrame = SoundBlok[i].CFrame:lerp(m.Hit, 0.1)
end
end
for i = 1, #SoundBlok2 do
if i == 1 then
SoundBlok2[i].CFrame = SoundBlok2[i].CFrame:lerp(m.Hit, 0.1)
end
end
end
end)
end)
This works but the errors slowly cause your game to lag out and eventually freeze
How would I go about fixing this? I've tried many things

1 comment
Your problem is line 3: You tried to create a function in the if statement. XP To fix this, just rewrite it as a function + event duo, or anonymous function. :) Also, I would recommend putting waits in the for loops to prevent that "lag," if that's what's causing that.