nvm all you needed to do was add ".Unit" before multiplying it
i made a raycasting script for a gun but i would like it to have limited range
heres my script
local gun = script.Parent
local event = gun.Shoot
local function OnEventFired(plr,mousePos)
local shotOrigin = gun.Flare.Position
local shotEnd = mousePos
local shotDirection = (shotEnd - shotOrigin)*100
local shotParams = RaycastParams.new()
shotParams.FilterDescendantsInstances = {gun.Handle, gun.Flare}
shotParams.FilterType = Enum.RaycastFilterType.Blacklist
local shotResult = workspace:Raycast(shotOrigin,shotDirection)
if shotResult then
print(shotResult.Instance)
end
end
i tried multiplying the rayDirection, but it just adds to the length, any help is appreciated :)
