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

My leveling Exp scripts not working. Can someone look at them please?

Asked by 6 years ago
Edited 6 years ago

Ok last time did not work lol. so lets try again...

In the Output I am getting that Config is not a valid member of Model... But that's all i'm getting. And the Player is not getting any exp. So is there something wrong with the two codes? (Leaderstats and NPC exp script) Or am I missing something from my Leaderstats script?

Leaderstats:

game.Players.PlayerAdded:Connect(function(Player) 
    local Leaderstats = Instance.new("Folder", Player) 
    Leaderstats.Name = "Leaderstats" 
    local Level = Instance.new("IntValue", Leaderstats) 
    Level.Name = "LevelLable" 
    Level.Value = 0 
    local Exp = Instance.new("IntValue", Leaderstats) 
    Exp.Name = "ExpLable" 
    Exp.Value = 0 
    if Player.Character and Player.Character:WaitForChild("Humanoid") then
        Player.Character.Humanoid.MaxHealth = 100 + Level.Value*10
    end
    Level.Changed:Connect(function(value)
    if Player.Character and Player.Character:FindFirstChild("Humanoid") then
        Player.Character.Humanoid.MaxHealth = 100 + Level.Value*10
        end
    end)
    Player.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").MaxHealth = 100 + Level.Value*10
        Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth
    end)
end)

Its the NPC script thats giving the: 20:10:57.577 - Config is not a valid member of Model (Line 1)

local exp = script.Parent.Config.XP.Value


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.XP.Value = Leaderstats.XP.Value + exp
wait(0.1) 
script:remove()
            end 
        end 
    end 
end 
Humanoid.Died:connect(PwntX_X) 
0
An object called Config isn't inside the model. Also, don't post free model code. That last snippet, is from an NPC free model. User#19524 175 — 6y
0
Sorry about the free model code... I'm pretty new to this... (I'm sure it's obvious lol...) If you have time could help me make one for this? or if you know a vid/site I can use as a reference? ranger176947 14 — 6y
0
If you take a Free Modeled code, try improving it. This means by changing the function(PwntX_X to onDied or something related) and make the free model code up to date or optimizing it saSlol2436 716 — 6y
0
Ok so just play around with it then. Thanks ranger176947 14 — 6y

Answer this question