Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

is there a way to add exp to an already written script?

Asked by 4 years ago
Edited 4 years ago

This is where I want to add the Exp when killed.

local Humanoid = script.Parent.Humanoid
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
if tag ~= nil then 
if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") 
if Leaderstats ~= nil then 
Leaderstats.Zims.Value = Leaderstats.Zims.Value + 250 
Leaderstats.Kills.Value = Leaderstats.Kills.Value + 1 



wait(0.1) 
script:remove() 
end 
end 
end 
end 

this is my Exp script

game.Players.PlayerAdded:Connect(function(player)
    local level = Instance.new("IntValue", player)
    level.Name = "Level"
    level.Value = 1

    local exp = Instance.new("IntValue", level)
    exp.Name = "Current"
    exp.Value = 0

    local maxExp = Instance.new("IntValue", level)
    maxExp.Name = "Max"
    maxExp.Value = 100


    exp.Changed:Connect(function(val)
        if exp.Value >= maxExp.Value then


            level.Value = level.Value + 1
            exp.Value = 0
            maxExp.Value = maxExp.Value * 1.25
        end
    end)
end)

workspace:WaitForChild("GiveEXP").ClickDetector.MouseClick:Connect(function(player)
    player.Level.Current.Value = player.Level.Current.Value + 25 -- Use this whenever you want to give the player exp.
end)

Answer this question