I have two items that are to be welded, each are found in Lighting. The code works perfectly fine in studio, but when i go in game it gives an error.
Here's the code first;
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait(); local tank = game.Lighting.Tank:Clone() tank.Parent = char local weld = Instance.new("Weld", char.Torso) weld.Part0 = char.Torso weld.Part1 = tank.Torso weld.C0=CFrame.new(tank.Torso) weld.C1=CFrame.new(char.Torso)
And here's the error; Torso is not a valid member of Model Script 'Players.doctortardiswho.Backpack.LocalScript', Line 5 Stack End
Would be nice if i could get an answer, if you need any more information please comment.
Try this:
local player = game.Players.LocalPlayer repeat wait(.01) until player.Character local char = player.Character local tank = game.Lighting.Tank:Clone() tank.Parent = char local weld = Instance.new("Weld", char.Torso) weld.Part0 = char.Torso weld.Part1 = tank.Torso weld.C0=CFrame.new(tank.Torso.CFrame) weld.C1=CFrame.new(char.Torso.CFrame)