Why is the output saying the local players name, instead of the "hit"' name?
So i'm trying to detect when a part gets touched, and if hit has met a certain qouta, inflict damage. heres the script.
LOCAL SCRIPT
01 | script.Parent.Main.Touched:connect( function (hit) |
02 | if hit.Parent.Name ~ = player.Name then |
03 | if hit.Parent.Humanoid then |
04 | if CanDamage.Value = = true then |
05 | script.Parent.DamageEvent:FireServer(hit.Parent.Name) |
06 | CanDamage.Value = false |
SERVER SCRIPT
1 | DamageEvent.OnServerEvent:connect( function (playerhit) |
3 | workspace:FindFirstChild(playerhit).Humanoid:TakeDamage( 30 ) |
so when i press play and hit something, (the output should say four, since im hitting a dummy named four), the output prints out the local players name. and saying its a nil value- even though ive checked over everything and it should be working.
2 | 02 : 55 : 47.252 - Players.Envoked.Backpack.Test Sword.Yeah: 36 : attempt to index a nil value |
3 | 02 : 55 : 47.252 - Stack Begin |
4 | 02 : 55 : 47.253 - Script 'Players.Envoked.Backpack.Test Sword.Yeah' , Line 36 |
5 | 02 : 55 : 47.253 - Stack End |