Basically I'm trying to make a weapon module, but it's not working when I try to use self, meaning everything breaks because I can't get the exact copy of the weapon. Not much more to say, this is my code, any help will be helpful.
function BasicSword:Equip() if not self.Owner then print('no owner') return end local Character = self.Owner.Character if Character then print('found owner') local CurrentSword = self.Part:Clone() CurrentSword.Parent = self.Owner.Character local Weld = Instance.new("Weld",CurrentSword) Weld.Part0 = CurrentSword Weld.Part1 = Character.RightHand Weld.C0 = CFrame.new(0,0,2) local Humanoid = Character:FindFirstChildOfClass("Humanoid") if Humanoid then local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://66331528" Humanoid:LoadAnimation(Animation):Play() end end end
Solved it, I thought it was the function, but I was executing the function by doing "PlayerWeapon.Equip()", so self isn't passed in, whereas "PlayerWeapon:Equip()" does pass it in.