Hey there Im working on a script and im getting the error ‘Attempt to index nil with parent’ here is my code
script.Parent.Parent.ChildAdded:connect(function(child)
if child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
The error is on line 2.
Its in a if statement so its quite strange.
Maybe there is some way to determine if the value is nil without throwing a error