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

i got a bad cast error on a welding script?

Asked by 7 years ago

i got a bad cast error on a weld script i was working on this is the script

Right = game.Lighting.SpellCaster:Clone()
Left = game.Lighting.SpellCaster:Clone()

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        local LeftH = character.LeftHand
        local RightH = character.RightHand

        local weldr = Instance.new('Weld', Right)
        weldr.Parent = Right
        weldr.Part0 = Right
        weldr.Part1 = RightH
        weldr.C0 = Right.CFrame:inverse()
        weldr.C1 = RightH.CFrame:inverse()

        --local weldl = Instance.new('ManualWeld', Left)
    end)
end)

it is supposed to weld two things the right hand weapon to the right hand and the left hand weapon to the left hand (tested right before beginning left)

the error is on line 11 --weldr.Part0 = Right--

is there someone who can help me ? thanks

****The 'SpellCaster' is a model/group of parts/parts

(if information is missing comment pls)

Answer this question