Hello Developers ,
I am having trouble finding out how to fix this error.
- Attack function (One with the error)
function Attack(torso, Distance)
if CoolDown <=0 or Refresh == true then
local laser = Instance.new("Part", workspace.Projectiles)
laser.Name = "Laser"
laser.Anchored = true
laser.CanCollide = false
laser.CastShadow = false
laser.Shape = "Cylinder"
laser.Color = Color3.fromRGB(255, 0, 0)
laser.Material = Enum.Material.Neon
laser.CFrame = CFrame.new(script.Parent.Position, torso.Position) * CFrame.new(0, 0, - Distance/2)
laser.Size = Vector3.new(4, GetDistance(torso, Distance), 4)
laser.Transparency = 0.5
end
end
- Function that is apart of the error
local function GetDistance(torso, Distance)
Distance = (script.Parent.Position - torso.Position).magnitude
return Distance
end
Feel to make any edits to this script!
EDIT: the line 52 and, 76 are all linked to line 43 (Attack Function) don’t worry about it unless you positive its something to do with that!