I'm not really good at scripting but I think the conditional here can determine if a bullet damages a player or not, can anyone help me?

function Fire(ShootingHandle)
	local PierceAvailable = Module.Piercing
	PiercedHumanoid = {}
		Tool.Muzzle.FlashFX.Enabled = true
		wait(.0000001)
		Tool.Muzzle.FlashFX.Enabled = false
	if FireAnim then FireAnim:Play(nil,nil,Module.FireAnimationSpeed) end
	if not ShootingHandle.FireSound.Playing or not ShootingHandle.FireSound.Looped then ShootingHandle.FireSound:Play() end
	local Start = (Humanoid.Torso.CFrame * CFrame.new(0,1.5,0)).p--(Handle.CFrame * CFrame.new(Module.MuzzleOffset.X,Module.MuzzleOffset.Y,Module.MuzzleOffset.Z)).p
	local Spread = Module.Spread*(AimDown and 1-Module.SpreadRedution or 1)
	local Direction = (CFrame.new(Start,Mouse.Hit.p) * CFrame.Angles(math.rad(-Spread+(math.random()*(Spread*2))),math.rad(-Spread+(math.random()*(Spread*2))),0)).lookVector
	while PierceAvailable >= 0 do
		local Hit,EndPos = RayCast(Start,Direction,5000,Character)
		if not Module.ExplosiveEnabled then
			if Hit and Hit.Parent then
				local TargetHumanoid = Hit.Parent:FindFirstChild("Humanoid")
				local TargetTorso = Hit.Parent:FindFirstChild("Torso")
				if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
					local hitPlayer = game.Players:GetPlayerFromCharacter(TargetHumanoid.Parent)
					if hitPlayer and game.Players.LocalPlayer.Team ~= hitPlayer.Team then
						InflictTarget:FireServer(TargetHumanoid,
												TargetTorso,
												(Hit.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage * Module.HeadshotDamageMultiplier or Module.BaseDamage,
												Direction,
												Module.Knockback,
												Module.Lifesteal,
												Module.FlamingBullet)
						PiercedHumanoid[TargetHumanoid] = true
				else
					PierceAvailable = 0
				end
			end
		end

5 comments

0

This is obviously a free script. Please only post questions related to scripts you have written and ask the owner of the script about it.

0

no

0

you don't need the wait(.00000000001), just use wait()

0

I've sent messages a few times to the original owner but he isn't responding. Plus, there isn't a rule where you actually have to provide your own script @luke. You have to provide a script.

0

We aren't going to fix a script you didn't make nor have knowledge about