Help fixing Springs script

So, I watched this tutorial by @EgoMoose that was made about 5 years ago on his YouTube channel demonstrating and explaining springs and Hooke’s law. I really love swaying movements and cartoony, sling-y effects, so I of course was going to check it out. I had done what he did in the video and wrote out the scripts and everything, but once I pressed play I got a nil error in the local script. If you could help out, that’ll be greatly appreciated. Here’s the Module and Local sciript - the error is in the Local script on line 16 (" spring:update() "):

Module Script:

local spring = {};

function, velocity, target)
	selfs = setmetatable({}, {_index = spring});
	selfs.position = position;
	selfs.velocity = velocity; = target;
	selfs.k = 1;
	selfs.friction = 1;
	return selfs;

function spring:update()
	local d = ( - selfs.position);
	local f = d * selfs.k;
	selfs.velocity = (selfs.velocity * (1 - selfs.friction)) + f;
	selfs.position = selfs.position + selfs.velocity

return spring;

Local Script:

local part ="Part", game.Workspace);
part.Anchored = true;
part.BrickColor = BrickColor.Green();

local mouse = game.Players.LocalPlayer:GetMouse();
mouse.TargetFilter = part;

local springModule = require(game.Workspace.Spring);
local spring =,, mouse.Hit.p);

spring.k = 0.05;
-- spring.friction = 0.1;

game:GetService("RunService").RenderStepped:Connect(function() = mouse.Hit.p;
	part.CFrame =;