1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 | local BulletEvent = ReplicatedStorage:WaitForChild( "BulletEvent" ) |
3 | BulletEvent.OnServerEvent:Connect( function (Player,Target,Hit) |
4 | if Target.Parent:FindFirstChild( "Humanoid" ) ~ = false then |
5 | Target.Parent.Humanoid:TakeDamage( 15 ) |
6 | end |
7 | end ) |
returns " Players.XTOOTHLESX.Backpack.Tool.Script:4: attempt to index nil with 'Parent' "
Try this.
1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 | local BulletEvent = ReplicatedStorage:WaitForChild( "BulletEvent" ) |
3 | BulletEvent.OnServerEvent:Connect( function (Player,Target,Hit) |
4 | if Target.Parent:FindFirstChild( "Humanoid" ) ~ = nil then |
5 | Target.Parent.Humanoid:TakeDamage( 15 ) |
6 | end |
7 | end ) |