-
What do you want to achieve? I want to achieve a hitscan module that can be used for guns and stuff.
-
What is the issue? It keeps doing the “Unable to cast double into Vector3 ” for some reason.
-
What solutions have you tried so far? I have looked for solutions on DevForum, ScriptingHelpers and Google. None of them worked, to say the least.
Does anyone know how to fix this issue? If so, how?
Here’s the code:
local module = {}
local ws = workspace
function module:CastBullet(startpos:Vector3,endpos:Vector3,damage:number,rp:RaycastParams,bulletcolor:BrickColor?)
if not bulletcolor then bulletcolor = BrickColor.new("Bright yellow") end
local result = ws:Raycast(startpos,CFrame.lookAt(startpos,endpos):ToOrientation(),rp)
if result and result.Instance then
print("raycast success")
end
end
return module
The error lies at line 6.