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

Giving "bad cast" error when trying to weld backpack, why?

Asked by
enes223 327 Moderation Voter
5 years ago

Im trying to weld backpack to character but its giving "bad cast" error and I cant figure it out, can anyone help? Code:

--By enes223

local SS = game:GetService("ServerStorage")
local Backpack = SS:WaitForChild("Backpack"):Clone()

game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:wait()
if char.Torso then
Backpack.Parent = char
local localBackpack = char.Backpack
local w = Instance.new("Weld")
w.Part0 = char.Torso
w.Part1 = localBackpack
w.C1 = w.C0 * -1
end
end)

Answer this question