local rp = game:GetService("ReplicatedStorage")
local Sword = rp:WaitForChild("Sword")
local cframes = {
["Right Arm"] = CFrame.new(0,-1,0),
["Right Hand"] = CFrame.new(0,0,0)
}
Sword.OnServerEvent:Connect(function(Player,isEquipped)
local Character = Player.Character
local Humanoid = Character.Humanoid
if isEquipped then
--Equipping the sword
local Katana = Character:FindFirstChild("Katana")
if Katana then
local SideWeld = Katana.PrimaryPart:FindFirstChild("SideWeld")
if SideWeld then
SideWeld:Destroy()
if Humanoid.RigType == Enum.HumanoidRigType.R15 then
Katana:SetPrimaryPartCFrame(Character:WaitForChild("RightHand").CFrame * cframes.RightHand)
elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
Katana:SetPrimaryPartCFrame(Character:WaitForChild("Right Arm").CFrame * cframes["Right Arm"])
end
local HandWeld = Instance.new("ManualWeld")
HandWeld.Part0 = Katana.PrimaryPart
if Humanoid.RigType == Enum.HumanoidRigType.R15 then
HandWeld.Part1 = Character:WaitForChild("Righthand") -- this is the errored line
elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
HandWeld.Part1 = Character:WaitForChild("Right Arm")
end
HandWeld.C0 = > HandWeld.Part0.CFrame:ToObjectSpace(HandWeld.Part1.CFrame)
HandWeld.Parent = HandWeld.Part0
end
end
elseif not isEquipped then
--Unequipping the sword
end
end)
Note: This problem only happens in R15 and I want the game to be compatible with both R15 and R6

1 comment
When you're looking at it use the view source button as it makes it easier to read because it's not cut off then.