Answered by
2 years ago Edited 2 years ago
Firstly, we want to make sure you put the script into ServerScriptService. If this still doesn't work, try to move it in different places. Secondly, make sure you placed YOUR creator ID and YOUR badge ID.
The code bartekrabit came up with was this:
01 | local badgeId = 0000 (PUT YOUR BADGE ID) |
02 | local userId = 0000 (PUT YOUR USER ID) |
04 | 03 function awardBadgeOnDeath(player, badgeId) |
05 | 04 player.CharacterAdded:connect( function (char) |
06 | 05 char.Humanoid.Died:connect( function () |
07 | 06 local killer = char.Humanoid:FindFirstChild( "creator" ) |
09 | 08 game:GetService( "BadgeService" ):AwardBadge(killer.Value.userId, badgeId) |
15 | 14 game.Players.PlayerAdded:connect( function (player) |
16 | 15 function awardBadgeOnDeath(player, badgeId) |
17 | 16 player.CharacterAdded:connect( function (char) |
18 | 17 char.Humanoid.Died:connect( function () |
19 | 18 local killer = char.Humanoid:FindFirstChild( "creator" ) |
21 | 20 if killer.Value.userId = game.CreatorId then |
22 | 21 game:GetService( "BadgeService" ):AwardBadge(killer.Value.userId, badgeId) |
I've re-written it a bit and modified some stuff. You must put it in ServerScriptService and if it still doesn't work, seek further help from YouTube, google etc. Another suggestion would be placing the script in other places like WorkSpace, etc.
This script actually DID work for me so I'm guessing it'll help you aswell.
The reason it may not ALWAYS work was because you must've written something wrong in the script which i already covered. This IS for when you kill the owner and not when the owner kills you. Modifiying the script to make it when the owner kills you should be easy. There are some tutorials, if not many tutorials on YouTube for similar things. There are model scripts aswell so inserting them into your game wouldn't be a harm. If you want to learn how the script works if you didn't script it yourself, look through the script and make sense/search up what they mean.
Hope this all helped.
p.s: this worked for me.