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

Interestingly, this module script is refusing to acknowledge it's own functions?

Asked by 6 years ago

Le module in question:






local BezierCurve = {} function BezierCurve.Linear(Percent,P0,P1,Ins,Property) local t = Percent/100 t = t >= 1 and 1 or t if P0 and P1 then if Ins and Ins[Property] then if Property == "CFrame" then local P0 = P0.p local P1 = P1.p Ins[Property] = CFrame.new(P0 + t * (P1-P0)) else Ins[Property] = P0 + t * (P1-P0) end else return P0 + t * (P1-P0) end end end function BezierCurve.Quadratic(Percent,P0,P1,P2,Ins,Property) local t = Percent/100 t = t >= 1 and 1 or t if P0 and P1 and P2 then if Ins and Ins[Property] then if Property == "CFrame" then local P0 = P0.p local P1 = P1.p local P2 = P2.p Ins[Property] = CFrame.new((1-t)^2 * P0 + 2 * (1-t) * t * P1 + t^2 * P2) else Ins[Property] = (1-t)^2 * P0 + 2 * (1-t) * t * P1 + t^2 * P2 end else return (1-t)^2 * P0 + 2 * (1-t) * t * P1 + t^2 * P2 end end end function BezierCurve.Cubic(Percent,P0,P1,P2,P3,Ins,Property) local t = Percent/100 t = t >= 1 and 1 or t if P0 and P1 and P2 and P3 then if Ins and Ins[Property] then if Property == "CFrame" then local P0 = P0.p local P1 = P1.p local P2 = P2.p local P3 = P3.p Ins[Property] = CFrame.new((1-t)^3 * P0 + 3 * (1-t)^2 * t * P1 + 3 * (1-t) * t^2 * P2 + t^3 * P3) else Ins[Property] = (1-t)^3 * P0 + 3 * (1-t)^2 * t * P1 + 3 * (1-t) * t^2 * P2 + t^3 * P3 end else return (1-t)^3 * P0 + 3 * (1-t)^2 * t * P1 + 3 * (1-t) * t^2 * P2 + t^3 * P3 end end end function BezierCurve.Interp(Method,StartPercent,DesiredPercent,Duration,Callback,...) local Start = tick() local EndTime = Start + Duration local PercentDif = DesiredPercent - StartPercent while tick() < EndTime do wait() local NewPercent = StartPercent + PercentDif * ((tick()-Start)/Duration) if Method == "Linear" then BezierCurve.Linear(NewPercent,...) elseif Method == "Quadratic" then BezierCurve.Quadratic(NewPercent,...) elseif Method == "Cubic" then BezierCurve.Cubic(NewPercent,...) end end if Callback then Callback() end end return BezierCurve

When require()'d and I attempt to use BezierCurve.Interp() from any other script, it returns the error 'Interp is not a valid member of ModuleScript'. Have I just missed something with syntax and I'm too fried to tell? Example:

BezierCurves.Interp("Quadratic", 0, 100, 2, 0, P1, P2, P3, Grenade, "CFrame")
0
Please edit your question to also include where you define the variable BezierCurves, because your problem lies in your usage, not in the actual module. amanda 1059 — 6y
0
Where you define it in a normal script* amanda 1059 — 6y

1 answer

Log in to vote
0
Answered by
oreoollie 649 Moderation Voter
6 years ago
Edited 6 years ago

You problem lies in the fact that you did not require the module correctly. Try adding this code into your script before attempting to use a function from the module.

local BezierCurves = require() -- Module location here

If my answer solved you problem, please don't forget to mark it as right.

0
I have require()'d it. I stated this. InfiniteYield 41 — 6y
0
You didnt include the line that require()s it. I wasnt sure if you made it a variable properly oreoollie 649 — 6y
Ad

Answer this question