So I am trying to make a Leveling System. To gain EXP, you must touch a block. The script is within the Part that needs to be touched. Now, I am getting an error that says ' attempt to index nil with 'LevelsInfo'' The problem is, the script isn't able to find the LevelsInfo which is a Fold with String Values within the Player. I know that I will more than likely have to use a Local Script for this, but why won't it work with a Local Script. If it is possible though to use a normal Script, how would I go about doing that. This is the line that it gets into trouble at 'player.LevelsInfo.Experience.Value += expToGain' Thanks in the long run! -XRangerGuyX
local part = script.Parent
local debounce = false``
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not debounce then
debounce = true
local playersFinished = 0
wait(3)
if playersFinished == 0 then
print("A Player Has Finished!")
local expToGain = 3
playersFinished += 1
player.LevelsInfo.Experience.Value += expToGain
elseif playersFinished >= 2 then
print("A 2nd Player Has Finished!")
local expToGain = 1
player.LevelsInfo.Experience.Value += expToGain
end
wait(1)
debounce = false
end
end)

4 comments
attempt to index nil with 'FindFirstChild' is what comes up..
Then you dont even have a folder
No.. I definitely do..
There's no reason to use FindFirstChild if you're not going to check to see if it returns nil. The error with indexing nil with 'FindFirstChild' definitely means that either 'player' is nil or that the 'LevelsInfo' folder either isn't actually named 'LevelsInfo' or hasn't been created (yet). You can use print statements to figure out which, ex: print(player, player and player:FindFirstChild("Level