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

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

Asked by
ZITOI 0
9 years ago

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

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

"Bad cast" is an unspecific error message that tells you that you used the wrong kind of thing somewhere1

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 

0
thank you!! ZITOI 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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

Answer this question