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.
01 | local Tool = script.Parent.Parent |
03 | local Anim = script:WaitForChild( "Animation" ) |
09 | Tool.Activated:Connect( function () |
16 | local humanoid = Tool.Parent.Humanoid |
18 | AnimTrack = humanoid:LoadAnimation(Anim) |
25 | Tool.HitBox.Touched:Connect( function (hit) |
26 | if hitChars [ hit.Parent ] or not debounce then |
30 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
31 | local eChar = hit.Parent |
32 | local plrChar = Tool.Parent |
34 | local eHumanRootPart = eChar:FindFirstChild( "HumanoidRootPart" ) |
35 | local plrHumanRootPart = plrChar:FindFirstChild( "HumanoidRootPart" ) |
36 | if plrHumanRootPart and eHumanRootPart then |
37 | script.Disabled = true |
38 | eChar.Humanoid.Sit = true |
40 | local force = Instance.new( "BodyVelocity" , eHumanRootPart) |
41 | force.MaxForce = Vector 3. new( 2 , 2 , 2 ) * math.huge |
42 | local direction = (eHumanRootPart.CFrame.Position - plrHumanRootPart.CFrame.Position).Unit |
43 | force.Velocity = (direction + Vector 3. new( 0 , 1 , 0 )).Unit * 250 |
45 | local rotation = Instance.new( "BodyAngularVelocity" , eHumanRootPart) |
46 | rotation.AngularVelocity = Vector 3. new( 1 , 1 , 1 ) * math.pi * math.random( 1 , 5 ) |
47 | rotation.MaxTorque = Vector 3. new( 2 , 2 , 2 ) * math.huge |
53 | eChar.Humanoid.Sit = false |
55 | local player = game.Players:GetPlayerFromCharacter(Tool.Parent) |
56 | player.leaderstats.Slaps.Value = player.leaderstats.Slaps.Value + 1 |
58 | local ePlr = game.Player:GetPlayerFromCharacter(eChar) |
59 | local BS = game:GetService( "BadgeService" ) |
62 | BS:AwardBadge(ePlr.UserId,id) |
64 | hitChars [ hit.Parent ] = true |
66 | script.Disabled = false |
67 | hitChars [ hit.Parent ] = nil |