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

Data is not a valid member of player?

Asked by 5 years ago
Edited 5 years ago

The title says my problem with the script I'm using, can someone please tell me the problem. And if you require the script I will provide it :)

game.Players.PlayerAdded:connect(function(Player) 
    local Data = Instance.new("IntValue",Player)
    Data.Name = "Data" 
    local XP = Instance.new("IntValue",Data) 
    XP.Name = "XP" 
    XP.Value = 0
    local Level = Instance.new("IntValue",Data) 
    Level.Name = "Level" 
    Level.Value = 1 
    local Tries = Instance.new("IntValue",Data)
    Tries.Value = 10
    Tries.Name = "Tries"
    local Data = Instance.new("IntValue",Player)
    Data.Name = "leaderstats"
    local Level = Instance.new("IntValue",Data)
    Level.Name = "Level"
    Level.Value = 1
    XP.Changed:connect(function() XPChange(Player,XP,Level) end)

end)

function XPChange(Player,XP,Level) 
    if XP.Value >= Level.Value*150  then 
        XP.Value = 0 
        Level.Value = Level.Value+ 1
    end
end
0
Yes it would be helpful, did you accidentally use game.player instead of game.players? It’s recommended to use game:GetService(Players) anyway, if that’s the issue. ABK2017 406 — 5y
0
We gotta see the script. waifuSZN 123 — 5y
0
Yeah... We need the script. frostingclowns 0 — 5y
0
I gave script so it be easier to understand the problem chad_universal 4 — 5y
View all comments (3 more)
0
When I play this script in my game, nothing goes wrong in the Output... also use Connect instead of connect. Pojoto 329 — 5y
0
What line does this error happen? I've had this error appear when it actually meant something else. Also your XPChange() function will only change the Level under Leaderstats because you redefined the Level variable. Phantom1996 45 — 5y
0
I've found out the problem with script thanks for helping anyway chad_universal 4 — 5y

Answer this question