Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

when i try to create weld it says bad cast. why?

here is the script:

local i = Instance.new("ManualWeld", game.Workspace.Instanc) i.Name = "weld" i.Part0 = i i.Part1 = game.Workspace.Instanc

2 answers

"Bad cast" is an unspecific error message that tells you that you used the wrong kind of thing somewhere[^1]

You should write your code on multiple lines, and it would tell you the problem is

i.Part0 = i

This isn't valid. i is a ManualWeld, but Part0 needs to be a Part.

[^1]: "Bad cast" comes from C++, where it means you tried to turn one thing into another, but couldn't

1 comment

0

thank you!!

I see that BlueTaslem Already answered this, but i decided to give my solution to you problem anyways. Hope this helps somehow.

Part0 = game.Workspace.Instanc.Part0
Part1 = game.Workspace.Instanc.Part1
local i = Instance.new("ManualWeld", Part0) i.Name = "weld"
wait() 
i.Part0 = Part1 
i.Part1 = Part0

This discussion is preserved as it was. New answers, comments, and votes are closed.