Answered by
5 years ago Edited 5 years ago
I think it's because the Hum.Died event will only run if it was a headshot because it's under the if statement that checks if it was a headshot. To fix it it should b
e something like that:
02 | local HeadshotDamage = 50 |
05 | script.Parent.FireEv.OnServerEvent:Connect( function (Player, Shooter, MousePos) |
06 | if script.Parent.Ammo.Value = = 0 then return end |
07 | script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1 |
08 | script.Parent.FirePart.Fire:Play() |
09 | local Bullet = Instance.new( "Part" , workspace) |
10 | Bullet.CFrame = script.Parent.FirePart.CFrame |
11 | Bullet.Size = Vector 3. new( 0.15 , 0.15 , 0.15 ) |
12 | Bullet.BrickColor = BrickColor.new( "Bright yellow" ) |
13 | Bullet.TopSurface = "Smooth" |
14 | Bullet.BottomSurface = "Smooth" |
15 | Bullet.Material = "Neon" |
16 | Bullet.CanCollide = false |
17 | local BVol = Instance.new( "BodyVelocity" , Bullet) |
19 | BVol.Velocity = MousePos.lookVector * 250 |
22 | Bullet.Touched:Connect( function (Toucher) |
23 | if Toucher.Parent = = Shooter then return end |
24 | local Hum = Toucher.Parent.Humanoid |
29 | if Toucher.Name = = "Head" then |
30 | Hum:TakeDamage(HeadshotDamage) |
31 | print (Hum.Parent.Name) |
35 | Hum:TakeDamage(Damage) |
45 | local humanoid = game.Players.LocalPlayer.Character.Humanoid |
46 | humanoid.Died:Connect( function () |
49 | print ( "I wonder if he's the spy..." ) |
50 | if OwnerSpyVal = = false and Hum.Parent:GetPlayerFromCharacter().Spy.Value = = false then |
51 | print ( "Oh no he's not!" ) |
52 | script.Parent.Parent:GetPlayerFromCharacter():Kick() |
Now, I'm not sure about it, but it might be the problem. If it still doesn't work, please make a comment in my answer.