Help on a kill zombie for money script

Hello Scripters! I need some help on a kill a zombie for money script that im making. I have made a script but it only works when I kill the zombie with a classic sword. However when i kill it with a gun it doesn’t work. I think I know why: The script cant tell who killed the zombie, because the guns bullets dont have any info about who shot it. Now, that makes sense but I dont know how to script this to work. The gun I am using is extremely complex (At least for me) but I dont think it will be hard to edit to make it to have info about who shot it. Anyways, this is the gun i am using. The AR gun from the weapons kit provided by ROBLOX. Here is a link to get it: Auto Rifle - Roblox
Ok so now here is the current script that I am using that only works with the classic sword:

Can anyone help me now to make the script be able to identify who shot the gun by making the gun put info about who shot it into each bullet? Or whatever needs to be done to make it work. If you would like more info, just ask!

Moved to #help-and-feedback:scripting-support, be more careful.

1 Like

Sorry this is my first post I am still learning how to do that

If you’re using remote events for the bullets then when you call the event it will always contain the player who fired it inside of the server script just make the first parameter “player”.

ok lemme check if it has any remote events

Yes it does use remote events but the script that receives the remote event is actually in the same folder that the remote event is in.

That’s fine as long as it’s accessible by both server and client I’ll make something up for you real quick.

Ok thats great! I am new to LUA so I dont know too much about scripting. But any help is appreciated!

Here you go, made this up in a few minutes so you can get the basics.

It’s uncopylocked so you can view all the code. You will notice in server script storage the function
local function onCreatePart(player, partColor, velocityInput) in the script FireballHandler, the first parameter stores the player who fired it.

Ok thankyou I will view that place!

Ok so you mean like if you send a remote event there are these things(), and you have to write player in between like this? (player)

Oh it already sends “player” so why does it not work if it already sends “player”

I’m unsure of what is being asked.?

So like it already sends information, in this case “player” with the remote event.

like this: function NetworkingCallbacks.WeaponReloadRequest(player, instance)
Also Idk what this does

Ah okay, so basically that is your player itself inside game.Players. So if you are accessing money from that or something it could be in player.Stats.Money or however you have it laid out. If it’s stored in the character it would be player.Character.Money or wherever you have it.

I have it in the player.leaderstats

1 Like

So what edit do I make to my “give money on kill script”?

where is the script located and is it local, module or normal?

its normal and it is inside the zombie which is in workspace.