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

My Badge script isn't working to how I want it to, If you knows how to fix it I would be greatful?

Asked by 2 years ago
Edited 2 years ago

I need help with this badge awarding script, can I please have help with it, I am following a series of tutorials by NetheriteStudio and im trying to fix some buggy script.

01local Tool = script.Parent.Parent
02 
03local Anim = script:WaitForChild("Animation")
04local AnimTrack
05 
06local hitChars = {}
07local debounce = false
08 
09Tool.Activated:Connect(function()
10    if debounce then
11        return
12    end
13 
14    debounce = true
15 
View all 69 lines...
0
show full script pls T3_MasterGamer 2189 — 2y
0
oh kk Puppy_lovertheawsome 84 — 2y
0
done Puppy_lovertheawsome 84 — 2y
0
oh also This is in the handle of my glove tool (This is an SB fan game) Puppy_lovertheawsome 84 — 2y
View all comments (7 more)
0
I am guessing if it is in the handle it might be a local script? I don't believe badges can be given out from the client to prevent exploits. Jay123abc2 241 — 2y
0
nah its not a local script its a normal script Puppy_lovertheawsome 84 — 2y
0
Rip I gtg now I will be back another time, Cya! Puppy_lovertheawsome 84 — 2y
0
Yeh, if it is on a local script that will be why. Badges can not be given from the client. If it is on a server script then it is a different issue. https://create.roblox.com/docs/reference/engine/classes/BadgeService#AwardBadge Jay123abc2 241 — 2y
0
ok thx be here another time cya Puppy_lovertheawsome 84 — 2y
0
Can't find the issue, check for any errors. Jay123abc2 241 — 2y
0
Can't find the issue, check for any errors. Jay123abc2 241 — 2y

1 answer

Log in to vote
2
Answered by 2 years ago
Edited 2 years ago
  1. game.Player doesn't exist and should be using game.Players.
  2. ePlr could be an NPC and that could break the script. You should always check if it's an actual player using Players:GetPlayerFromCharacter().
  3. Instead of indexing hit.Parent as a dictionary, you can use table.insert() and table.remove() as an array.
  4. Before awarding a badge, you should use BadgeService:GetBadgeInfoAsync() and BadgeService:UserHasBadgeAsync() to avoid errors.
  5. In case BadgeService:AwardService(), loop it until successful.
  6. When using LoadAnimation(), it is recommended to use Humanoid.Animator instead of Humanoid.
  7. Before playing animations, keep checking AnimationTrack.Length until it is more than zero (fully loaded).
  8. Tip: If you want an animation to play first than other animations, change AnimationTrack.Priority to Enum.AnimationPriority.Action4 (the highest priority).
  9. Disabling a script will make it stop and re-enabling it won't run again.
  10. Use task.wait() instead of wait().
001local Players = game:GetService("Players")
002local BadgeService = game:GetService("BadgeService")
003local Debris = game:GetService("Debris")
004 
005local Tool = script:FindFirstAncestorOfClass("Tool")
006local Anim = script:WaitForChild("Animation")
007 
008local hitChars = {}
009local debounce = false
010 
011local animStopped = Instance.new("BindableEvent")
012 
013Tool.Activated:Connect(function()
014    if debounce then return end
015 
View all 105 lines...
1
tysm bro I thought all of my hard work was wasted! Your a life saver. Puppy_lovertheawsome 84 — 2y
Ad

Answer this question