Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Expected BasePart got Model for Weld:Part1. how do i fix this?

Asked by 3 years ago

this is my code if you need it

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAppearanceLoaded:Connect(function(char)

        local h = game:GetService("ServerStorage"):FindFirstChild("KatanaModel"):Clone()
        if not char:IsA("Model") then return end

        local rHand = char:FindFirstChild("RightHand")
        h:SetPrimaryPartCFrame(rHand.CFrame * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)))

        local weld = Instance.new("Weld")
        weld.Part0 = rHand
        weld.Part1 = char

        weld.Name "HandleWeld"
        weld.Parent = rHand
        h.Parent = char
    end)
end)
0
char is the player's Character, a Model, Part1 of a Weld needs to be a Part Instance Spjureeedd 385 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

A Weld instance's Part0 and Part1 properties only take BaseParts and classes of which inherit BasePart. The char argument of the CharacterAppearanceLoaded event is a model. Unfortunately, due to lack of context, I can't figure out exactly what you want to achieve with this code, but the solution to this error is to set the Part1 property to a Part or a class that inherits BasePart.

Ad

Answer this question