My script only works one time

“Fatal” errors stop the script. If there are multiple errors, the new ones don’t show up until you fix the old one. Those aren’t the ones you need to worry about. The errors you need to worry about are the ones that do exactly what you told them to do, but are still wrong.


if boss and boss.Health <= 0 then -- Error: Humanoid is not a valid member of Model "Workspace.Boss"

And yep, there goes another error. Just found out that Humanoid gets destroyed after killing the boss, doesn’t give every players a reward. Tried some wait() below the statement aka “if then”, so all players in the server will receive a reward before Boss’s Humanoid will be destroyed, but it didn’t fix.

That’s a weird bug. The function giving out rewards does not use humanoid. By any chance are the people who don’t get rewards “New” as in they aren’t on the leaderboard already?

There will be no leaderboard. I use this function so players could buy some in-game items. ( sorry for bad grammar btw )

OK, I will rephrase the question. Are the people not receiving cash currently at 0?

I made another script which every 60 seconds, everyone will get 10 points and it repeats. Maybe it will never affect the reward script.

Unless you throw the health check into the damage script (so that the reward is given out right before the boss dies and the humanoid is deleted), I’m out of ideas. I thought heartbeat would be fast enough. /shrug

.HealthChanged is LocalScript only
.Died is LocalScript only