#help me in this script to make it after a kill the player gets exp

1 messages · Page 1 of 1 (latest)

south folio
#

local serverModules = game.ServerStorage:WaitForChild("ModuleScripts")
local PlayerStats = require(serverModules:WaitForChild("PlayerStats"))

local part = script.Parent

local db = {}
local dbTime = 0.6

part.Touched:Connect(function(hit)

local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

if plr and not db[plr] then
    
    db[plr] = true
    
    local min = 10
    local max = 80
    local randomExpToGive = math.random(min, max)
    
    PlayerStats.AddExp(plr, randomExpToGive)
    
    task.wait(dbTime)
    db[plr] = nil
end

end)