Hey i’m DevFoll and i’m wondering how i can make my raycast bullet reach a bit further so the touched event can work better. I tried Vector 3’s but still don’t work.
I’m making a shotgun btw
script.Parent.RemoteEvent.OnServerEvent:Connect(function(Player, MousePos)
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {Player.Character}
Params.FilterType = Enum.RaycastFilterType.Blacklist
local Raycast = game.Workspace:Raycast(script.Parent.Part.Position,( MousePos - script.Parent.Part.Position)*300, Params)
if Raycast then
script.Parent.Part.PointLight.Enabled = true
script.Parent.Ammo.Value -= 1
script.Parent.Handle.fire:Play()
local Bullet = game.ReplicatedStorage.Bullet:Clone()
Bullet.Parent = game.Workspace
Bullet.Position = MousePos
print(MousePos)
wait(0.2)
script.Parent.Part.PointLight.Enabled = false
Bullet.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health -= 70
Bullet:Destroy()
end
end)
end
end)