Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I 'kill' a player?

Asked by 4 years ago

I found this model throwing knife and when it hits another player, the other player falls apart and the health appears to be at 0 but doesn't re spawn so my game loop wont work unless that other player re spawns. Any suggestions?

0
Im doing this using the test on a local server with two players. On the screen of the player killing the other, it appears his health is at 0 and he has fallen apart. His humanoid health value is also 0 but the player that got hit and should be dead, on his screen he hasnt taken any damage and appears to be perfectly fine. WTF Vursatile 12 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

Hay great question, I think I can help!!!

This is important topic of "Filtering Enabled". When "Filtering Enabled" feature is on, nothing that's done by client gets replicated on the server.

What that actually means is that whatever you do with local script, will happen for that specific player only. This is great because it prevents exploiters from injecting local script and messing up entire server.

To make something like that work you'll need remotes. Remotes enable you to send requests from client(player), when needed, to server to make something happen(e.g kill player). This way you have, already defined behavior in server script which only gets executed when necessary.

So what you should do, is to find local script which makes knife kill player and turn it into server script and place it in ServerScriptService. In this script you should wrap entire functionality with remote event callback(see tutorial) and then you should fire request whenever knife hits the player.

0
You shouldn't really use remote events. An exploiter could easily use this and make a kill script out of it. A better way is to use rays and make the script server-side. If you don't want to do raycasting, region3 and .touched may help too. Jack_Hase 85 — 4y
0
Thanks for response. In fact I agree with you, but I can see that he's beginner, so he should start by something little less complex, but I should've noted that anyways so thanks DemaxDev 35 — 4y
0
@DemaxDev I am not really worrying about exploiters I just want it to work. But im a bit confused on how I would do what your talking about. Would doing this affect the other aspects of it? Heres the one im using if you could take a quick look at it https://www.roblox.com/library/441882008/Xbox-Murder-Knife Vursatile 12 — 4y
0
If you turn filtering enabled off then it will work, but as I mentioned earlier that will cause problems. You can find filtering enabled in properties of workspace DemaxDev 35 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
--use a touch function
knife.Touched:Connect(function(hit)
hit.Parent.Humanoid.Health = 0
end)
0
How would I apply that to this knife? https://www.roblox.com/library/441882008/Xbox-Murder-Knife Vursatile 12 — 4y
0
I'm not talking about this, but it would work normally. It already has humanoid.Health = 0 in the KnifeScript User#29913 36 — 4y

Answer this question