I'm trying to reward the player with exp every time they the punch a damageable object (punching bag, dummies, etc) Whenever the play punches something, it updates the exp leaderstat only once, does anyone know what i'm doing wrong?
My Script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
script.Parent.Touched:Connect(function(hit)
local Char = hit.parent
local Hum = Char:FindFirstChild("Humanoid")
if Hum and Char.Name ~= script.Parent.Parent.Name then
local Indicator = require(game.ReplicatedStorage.DamageIndicator)
local Player = script.Parent.Parent
local LocalPlayer = game.Players:GetPlayerFromCharacter(Player)
local Exp = LocalPlayer.leaderstats.Experience.Value
Hum:TakeDamage(script.Dmg.Value)
Indicator.DamageActivate(script.Dmg.Value, hit)
Exp = Exp + 15
LocalPlayer.PlayerGui.UI.Experience.ExpBar.Size = UDim2.new((Exp / 100) * 0, 0, 0.02, 0)
LocalPlayer.PlayerGui.UI.Experience.ExpBackground.ExpAmt.Text = Exp.."/100"
script.Disabled = true
end
end)