I'm working on a script that changes your stats when you finish a map. I'm getting an error after finishing the map. Apparently Parent is a nil value??
Error:
Workspace.Level1.Level_Content.Fundementals.Level_Finish.Script:10: attempt to index field 'Parent' (a nil value)
Script:
block
block
block
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
game.Workspace[Player.PlayerStats.CurrentLevel.Value]:remove()
Player.PlayerGui.Menu.LevelFrame.Visible = true
Player.PlayerGui.Menu.LevelFrame[Player.PlayerStats.CurrentLevel.Value].BackgroundColor3 = Color3.new(.100, .50, .234)
if Player.PlayerStats.Level.Value < script.Parent.Parent.Parent.Parent.Configurations.Level.Value then
Player.PlayerStats.Level.Value = Player.PlayerStats.Level.Value + 1
end
end
end)

3 comments
There is no "parent" on line 10.Your error is the wrong error, or the script is the wrong one.
I have it spaced to line 10 let me fix
try removing one parent or accessing it a different way using a WaitForChild() or FindFirstChild()