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

How to make each enemy killed give a unique reward to the player in the most efficient way?

Asked by 6 years ago

I face this situation all the time while making a game, for example say if your game has ores and you want each ore to give the player a unique reward. What I do in such situation is make an IF statement for each ore in all the weapon scripts and that's inefficient and time consuming.

Say if I had a game with lots of enemies and each type of enemy would add a unique amount of number to the player's score when killed. How would I do that without nested if statements? And preferably without even doing anything to the weapon script if possible, like have the weapon just send a remote event to a server script that handles everything when the player kills an enemy.

0
What you're doing already is a very bad way, let the player get money, you should the enemies give you money, not the sword, an exploiter can abuse that and give himself infinite money, in your situation, just add a 'killed' tag with a server script to the enemy, and let the enemy give you the items User#20388 0 — 6y

Answer this question