Why does this fire twice

I’m working on a small little side project rn and I keep on running into this problem. This would fire twice everytime it needs to be fired and I don’t know why.
It is in a local script and fires over to a server script.
I’ve checked the server script and I’m pretty sure the problem is on the local scripts side which is the image below.
image

If you want to see the server script segment that requires the event from the local script feel free to ask for it

Hi, you should try to use PlayerAdded instead of CharacterAdded and see if that resolves your issue. Could you please also state when it is meant to fire?

I want it to fire everytime the character is created so yeah. When it fires is when the character is added, It fires over to a server script. I’m honestly clueless about it. I’ll also send the server script image over because I’m not sure if its a problem with the server script or local.

I’ve found that it actually fires more than once or twice depending on death so I might have missed something.

sorry for the messy code.
The circled bit is the part that fires twice or more.


You could try to only fire playerData() when the Character is not equal to nil. From looking at it code it seems you have characterAdded on the server and client?

well yeah. I used the local script only to get player data to the server script due to the server script’s function not working correctly for some other reason. What do you mean by firing playerData() only?

Okay, well you are connecting the OnServerEvent every time CharacterAdded is triggered. This is most likely your problem since it will just keep connecting over and over until say there is 100 events that are listening for that one remote. You should have the OnServerEvent by itself.

2 Likes