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.
local Tool = script.Parent.Parent
local Anim = script:WaitForChild("Animation")
local AnimTrack
local hitChars = {}
local debounce = false
Tool.Activated:Connect(function()
if debounce then
return
end
debounce = true
local humanoid = Tool.Parent.Humanoid
if not AnimTrack then
AnimTrack = humanoid:LoadAnimation(Anim)
end
AnimTrack:Play()
wait(0)
debounce = false
end)
Tool.HitBox.Touched:Connect(function(hit)
if hitChars[hit.Parent] or not debounce then
return
end
if hit.Parent:FindFirstChild("Humanoid") then
local eChar = hit.Parent
local plrChar = Tool.Parent
local eHumanRootPart = eChar:FindFirstChild("HumanoidRootPart")
local plrHumanRootPart = plrChar:FindFirstChild("HumanoidRootPart")
if plrHumanRootPart and eHumanRootPart then
script.Disabled = true
eChar.Humanoid.Sit = true
local force = Instance.new("BodyVelocity", eHumanRootPart)
force.MaxForce = Vector3.new(2,2,2) * math.huge
local direction = (eHumanRootPart.CFrame.Position - plrHumanRootPart.CFrame.Position).Unit
force.Velocity = (direction + Vector3.new(0,1,0)).Unit * 250
local rotation = Instance.new("BodyAngularVelocity", eHumanRootPart)
rotation.AngularVelocity = Vector3.new(1, 1, 1) * math.pi * math.random(1,5)
rotation.MaxTorque = Vector3.new(2,2,2) * math.huge
rotation.P = 5000
wait(0.35)
force:Destroy()
rotation:Destroy()
eChar.Humanoid.Sit = false
local player = game.Players:GetPlayerFromCharacter(Tool.Parent)
player.leaderstats.Slaps.Value = player.leaderstats.Slaps.Value + 1
local ePlr = game.Player:GetPlayerFromCharacter(eChar)
local BS = game:GetService("BadgeService")
local id = 2141407136
BS:AwardBadge(ePlr.UserId,id)
end
hitChars[hit.Parent] = true
wait(2.5)
script.Disabled = false
hitChars[hit.Parent] = nil
end
end)

11 comments
show full script pls
oh kk
done
oh also This is in the handle of my glove tool (This is an SB fan game)
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.
nah its not a local script its a normal script
Rip I gtg now I will be back another time, Cya!
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
ok thx be here another time cya
Can't find the issue, check for any errors.
Can't find the issue, check for any errors.