hello so i got this script right here, and it works, but the thing is that the bullet that explodes hits my arms insantly after shooting the rpg, i want the script to be able to somehow avoid players body parts.
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local remoteEvent = ReplicatedStorage:WaitForChild('RPG')
local hit = ReplicatedStorage.Hit
local DamageToDoIfTheHitIsAPlayer = 0
remoteEvent.OnServerEvent:Connect(function(player, gunPos, gunOr, mosPos)
game:GetService("ReplicatedStorage").Launch:Play()
local bullet = Instance.new("Part")
bullet.Position = gunPos
bullet.Orientation = gunOr
bullet.Transparency = 0
bullet.Name = 'Bullet'
bullet.Parent = game.Workspace
bullet.Size = Vector3.new(.25, .25, .25)
bullet.BrickColor = BrickColor.new('Neon orange')
bullet.Shape = Enum.PartType.Block
bullet.CanCollide = true
local speed = 500
bullet.CFrame = CFrame.new(gunPos, mosPos)
bullet.Velocity = bullet.CFrame.lookVector * speed
bullet.Touched:Connect(function(otherPart)
local explosion = Instance.new('Explosion')
explosion.Name = "EXPLOSION"
explosion.Parent = workspace
explosion.BlastRadius = 4
explosion.BlastPressure = 500000
explosion.DestroyJointRadiusPercent = 1
explosion.ExplosionType = Enum.ExplosionType.Craters
explosion.TimeScale = 1
explosion.Position = bullet.Position
end)
end)