i have a katana which when i unequip its supposed to get the player and character but sometimes i get an error when getting the player because it thinks the katana is in Workspace and not the player
Katana.Unequipped:Connect(function()
equipped = false
local myplayer = Katana.Parent.Parent
print(myplayer)
local mycharacter = myplayer.Character or myplayer.CharacterAdded:Wait()
end
usually it prints the player name, as it should and it works but when i lag or when i spam equip/unequip, it gives me an error because it thinks the katana is in Workspace. so whats the best way to get the player?