I have a gun system and it works (exepct for the raycasting on humanoids half the time but I’ll fix that later)
But the problem is that when it shoots in the sky, it has no limit to how far it can shoot
Raycast :
local Cast = workspace:Raycast(script.Parent.FirePos.Position,MousePos - script.Parent.FirePos.Position)
Part Visualize
if Config.VisibleRaycastBullet.Value == true then
local distance = (origin - result).Magnitude
local p = Instance.new("Part")
p.Anchored = true
p.CanCollide = false
p.Size = Vector3.new(0.1, 0.1, distance)
p.CFrame = CFrame.lookAt(origin, result)*CFrame.new(0, 0, -distance/2)
p.BrickColor = BrickColor.new("New Yeller")
p.Parent = workspace
p.Transparency = .5
p.Material = Enum.Material.SmoothPlastic
p.CanQuery = false
p.CanTouch = false
local t = game.TweenService:Create(p,TweenInfo.new(Config.VisibleRaycastBullet.Time.Value),{Transparency = 1})
game.Debris:AddItem(p,Config.VisibleRaycastBullet.Time.Value)
end
video
BRO LOWER YOUR VOLUME ON VIDEO WHEN I WAS TESTING ITS NOT THAT LOUD
( I have no idea the message at top in video some kinda virus plugin that idk what it is but I don’t really care )