Why doesn't my script damage players sometimes?
This script damages any player that is hit by it, but if the player with the weapons stays still it instead passes through them without doing any damage...
03 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
04 | local model = hit.Parent |
05 | local hum = hit.Parent:FindFirstChild( "Humanoid" ) |
06 | if modelstuff [ model ] then |
09 | local def = hit.Parent:FindFirstChild( "Defense" ).Value |
10 | local dmg = script.Parent.Parent:WaitForChild( "Attack" ).Value - def |
12 | if hit.Parent:FindFirstChild( "Bleed" ) then |
13 | if hit.Parent:FindFirstChild( "Streak" ) then |
15 | local streak = Instance.new( "IntValue" ) |
16 | streak.Parent = hit.Parent |
17 | streak.Name = "Streak" |
19 | local st = hit.Parent:FindFirstChild( "Streak" ) |
20 | st.Value = st.Value + 1 |
21 | hit.Parent:FindFirstChild( "Bleed" ).Dmg.Value = hit.Parent:FindFirstChild( "Bleed" ).Dmg.Value + 1 |
22 | hit.Parent:FindFirstChild( "Bleed" ).Time.Value = hit.Parent:FindFirstChild( "Bleed" ).Time.Value + 1 |
23 | local bled = hit.Parent:FindFirstChild( "Head" ).Bleed |
24 | bled.TextLabel.Text = "Bleed X" .. st.Value |
26 | local bleed = game.ServerStorage.Effects.Bleed:Clone() |
27 | bleed.Disabled = false |
28 | bleed.Parent = hit.Parent |
30 | local h = hit.Parent:FindFirstChild( "HumanoidRootPart" ) |
31 | local bb = game.ServerStorage.Classes.BillboardGui:Clone() |
33 | local txtlabel = bb:WaitForChild( "TextBox" ) |
35 | txtlabel.TextColor 3 = Color 3. fromRGB( 255 , 0 , 0 ) |
37 | txtlabel.Text = tostring (dmg) |
39 | modelstuff [ model ] = true |
41 | modelstuff [ model ] = false |
44 | script.Parent.DmgBox.Touched:Connect(ontouch) |
Please help me, i cant script