I have been wanting to make a force choke, and it works server-side, which is excellent. There's a problem, though. When going ahead and clicking the torso of something with a humanoid in it, when the 'playchoke' event is fired, the server picks it up as my character being choked in the end. I'm confused, I believe I've done this correctly. A little support would be helpful, thanks. Here's some code from client-side and server-side:
Also, at the start of my Client-Side script, I have put the Player's Mouse's TargetFilter to nil, so it shouldn't choke my character if I'm clicking on models with humanoids:
v Client Script v
*-- Client-Side*
local mouse = player:GetMouse()
mouse.TargetFilter = nil
mouse.Button1Down:Connect(function()
if equipped == true then
print('ok')
if mouse.Target.Parent:FindFirstChild('Humanoid') then
local mouseTarget = game.Players:GetPlayerFromCharacter(mouse.Target.Parent)
print(mouseTarget)
script.playchoke:FireServer(mouseTarget) -- the choke event
print('doing choke')
end
end
end)
v Server Script v
*-- Server-Side*
script.Parent.client.playchoke.OnServerEvent:Connect(function(mouseTarget)
print(mouseTarget)
local dead = false
local damage = 15
local char = mouseTarget.Character
local humanoid = char.Humanoid
while true do
local anim = script.Parent.Handle.victumanim
local animtrack = humanoid:LoadAnimation(anim)
animtrack:Play()
wait(0.1)
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
humanoid:TakeDamage(damage)
wait(0.1)
print('should be choking')
end
end)
In the output, on the Server-Side script, the 'print(mousetarget)' comes up with my local player's name (me) and not the victum's name I clicked. On client-side, it goes ahead and prints the player's name that I've clicked on. I'm still very confused..

4 comments
Thanks mate I'll try this when I get up in the morning. Do I just copy your edited server side code into mine?
it isnt good practice to simply copy a script that is provided
the general message is that the first parameter of OnServerEvent is the player who fired the remote
Thanks so much mate, you're a legend. :D