[REPOST, HAD NO RESPONSE AFTER FINAL REPLY FOR 3 HOURS OLD POST]
As the title says, my script will not remove the other player’s health who get hit, and will not even increase their own leaderstat for some reason.
Any help is appreciated
local Default_Ball = game.Workspace.DefaultBall
local Tool = script.Parent
local Player = script.Parent.Parent
local Character = Player.Character
local Humanoid = Character.Humanoid
local leaderstat = Player:WaitForChild("leaderstats")
-- Ball
local Ball = script.Parent.Default -- Change according to ball name
local character = Tool.Parent
-- Sound
local HitSound = Instance.new("Sound")
HitSound.Parent = Ball
HitSound.SoundId = "8060079174" -- Change to a heavy hit if damage is more then 20, if higher then 80 then do a VERY heavy hit.
HitSound.Volume = 10
HitSound.RollOffMaxDistance = 30
HitSound.RollOffMinDistance = 5
-- Settings
local debounce = false
Ball.Touched:Connect(function(hit)
wait(0.05)
local enemyplayer = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if not debounce then
debounce = true
enemyplayer.Character.Humanoid.Health = enemyplayer.Character.Humanoid.Health - 14 -- Change according to ball
leaderstat.Smacks.Value = leaderstat.Smacks.Value + 1
HitSound:Play()
wait(2)
debounce = false
end
end)