I have a gun script and I have been working for 6 hours today to get it to damage someone when they get hit in the helmet.
The problem now is when a player gets hit it fires the server, but for some reason when a player gets hit in the helmet it doesnt fire the server even know the code is almost the same.
There are 2 scripts a local and a server side one here they are.
Local script
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") or Hit.Parent.Parent:FindFirstChild("Humanoid") local TargetTorso = Hit.Parent:FindFirstChild("UpperTorso") if Hit.Parent.Parent:FindFirstChild("Humanoid") then print("Helmet Hit") end --local TargetTEAM = Hit.Parent:FindFirstChild("TEAM") if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso or Hit.Parent.Parent:FindFirstChild("Humanoid") then print("ItFired") --if TargetTEAM and TargetTEAM.Value ~= TEAM.Value 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 --end else PierceAvailable = 0 end end else
Its just a small chunk of the code, its mostly the important stuff but there is the local script now heres the server script
Server script
InflictTarget.OnServerEvent:connect(function(Player,TargetHumanoid,TargetTorso,Damage,Direction,Knockback,Lifesteal,FlamingBullet) if Player and TargetHumanoid and TargetHumanoid.Health ~= 0 and TargetTorso then while TargetHumanoid:FindFirstChild("creator") do TargetHumanoid.creator:Destroy() end local creator = Instance.new("ObjectValue",TargetHumanoid) creator.Name = "creator" creator.Value = Player game.Debris:AddItem(creator,5) print("Server Fired") TargetHumanoid:TakeDamage(Damage) if TargetHumanoid.Health <= 0 then game.ReplicatedStorage.DataFile[Player.Name].AssaultClassKills.Value = game.ReplicatedStorage.DataFile[Player.Name].AssaultClassKills.Value + 1 end if Knockback > 0 then TargetTorso.Velocity = Direction * Knockback end if Lifesteal > 0 and Humanoid and Humanoid.Health ~= 0 then Humanoid.Health = Humanoid.Health + (Damage*Lifesteal) end if FlamingBullet then local Debuff = TargetHumanoid.Parent:FindFirstChild("IgniteScript") or script.IgniteScript:Clone() Debuff.creator.Value = Player Debuff.Disabled = false Debuff.Parent = TargetHumanoid.Parent end end end)
The script is supposed to when a player gets hit in the helmet fire to the server but it doesnt but when they get hit normally it does fire the server.
It prints "Helmet Hit" so it knows the helmet is getting hit it also prints "ItFired" but it doesnt print the serverside stuff when you get hit in the helmet.
Any ideas? Please please please help meeeee
Thank you for your time. :)