I get 2 errors in output:
attempt to index nil with Parent - Line 6
and
Argument 1 missing or nil - Line 12
I have no idea how to troubleshoot these errors and I need assistance with them if possible.
Code:
local Player = script.Parent.Parent.Parent
local Char = Player.Character
Char.Hitboxes.Part.Touched:Connect(function(inst)
if Char.Hitboxes.Part.Active.Value == true then
local player
if game:GetService("Players"):GetPlayerFromCharacter(inst.Parent) or inst.Parent:FindFirstChildOfClass("Humanoid").Parent.Name then
player = game:GetService("Players"):GetPlayerFromCharacter(inst.Parent) or inst.Parent.Name
else print("no")
end
--------
local Character
if player.Character or game.Workspace[player.Name] then
Character = player.Character or game.Workspace[player.Name]
else print("no")
end
print(Character)
print(Player.Name .. Player.Parent.Name)
end
end)

1 comment
I'm aware it sets a new connection, it's a function for each player. Thank you for your help!