Local scripts hitbox do not detect properly

  1. Problem:Hitbox kept detecting me not the dummies,and I have no idea why.

2.What I trying to do:I am trying to make a beatdown so I tried making a simple testing version but ran into this problem where the local script only detects me and still send the information to the server script.

The reason I am using local script to do hitboxes is because I want local script to pick the target then moves user’s camera(which needed local script to do it).

ServerScript:
image

LocalScript:

Video:

Help would be appreciated. :smiley:

1 Like

It’s the remote onserver parameters, by default the first parameter is the player who sent the remote event used for identifying who is who,

So do

function(player who sent,player, hit)

Within the onserver event.

3 Likes

Perhaps I dont understand,maybe you can explain it more for me?Thank you

rs = game:GetService(“ReplicatedStorage”)

rs.Beatdowns.Beatdown1Remote.OnServerEvent:Connect(function(player,hit)

print(“beatdown attempted”)

local hitted = hit.Name

print(hitted)

if hitted == player.Name then return end

hit.Character.Humanoid.Health = hit.Character.Humanoid.Health - 10

end)

Remote events

Note that the connected function (lines 6-12) will receive the Player who fired the event as its first parameter (player), along with any additional parameters passed from the FireServer() call.

From

To

rs.Beatdowns.Beatdown1Remote.OnServerEvent:Connect(function(playerSent, player,hit)

1 Like

Basically, when u fire remoteevent to server, the player who sent the remote is already passed by default, so it is not required to send the player data.

game.ReplicatedStorage["BeatDowns"].BeatDown1Remote:FireServer(hit) -- u just need to send hit variable.

-- In server script

rs.Beatdowns.Beatdown1Remote.OnServerEvent:Connect(function(player,hit)
1 Like