so yeah i borrowed a fastcast handler from a fps tutorial but it isn’t doing exactly what i want it to. it keeps returning this strange error
handler:
function fastcastHandler:fire(origin, direction, properties, isReplicated, weapon, repCharacter)
local rawOrigin = origin
local rawDirection = direction
-- if the propertie aren't already required just require them
if type(properties) ~= "table" then
properties = require(properties)
end
local directionalCFrame = CFrame.new(Vector3.new(), direction.LookVector)
direction = (directionalCFrame * CFrame.fromOrientation(0, 0, random:NextNumber(0, math.pi * 2)) * CFrame.fromOrientation(0, 0, 0)).LookVector
local bullet = replicatedStorage.GameItems.Bullet:Clone()
bullet.CFrame = CFrame.new(origin, origin + direction)
bullet.Parent = workspace.fastCast
bullet.Size = Vector3.new(0.05, 0.05, properties.firing.velocity / 200)
-- useful with the server security i made, almost useless in this fps demo
local id = math.random(-100000,100000)
local idValue = Instance.new("NumberValue")
idValue.Name = "id"
idValue.Value = id
idValue.Parent = bullet
bullets[id] = {
properties = properties;
replicated = isReplicated;
}
if not isReplicated then
replicatedStorage.weaponRemotes.fire:FireServer(rawOrigin, rawDirection, id)
end
-- Custom list; blacklist humanoidrootparts too if your players can croiuch and prone
local customList = {}
customList[#customList+1] = workspace.Camera
-- fire the caster
mainCaster:FireWithBlacklist(origin, direction * properties.firing.range, properties.firing.velocity, customList, bullet, true, Vector3.new(0, replicatedStorage.bulletGravity.Value, 0))
end