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

Help w/ weld?

When a player joins they are suppose to have a model called "Boat" to them. It clones to workspace but not to character :(

game.Players.PlayerAdded:connect(function(plr)
		plr.CharacterAdded:connect(function(char)
				local tors = char:WaitForChild('Torso') --tors is the character's Torso
				local Boat = workspace.Boat:Clone() --Define backpack as a part
				for _,Part in pairs(Boat:GetChildren()) do
					Part.Anchored=false
				end
				local weld = Instance.new('Weld',tors) --Create a new weld object inside tors
				weld.Part0 = tors --A weld needs 2 parts to funciton, this is one of them
				weld.Part1 = Boat.Part --This is the other one
				weld.C0 = CFrame.new(0,0,0)
				Boat.Parent = char --Parent it to the character
			end)
	end)

1 answer

✓ Accepted answer

Your main problem may be in line 05-07. If there are other things other than parts in the model, then the script will error. This is only a theory, may not be true. I'm not sure if this will be much help... Here you go anyway. Also, if you are testing in FPS mode, the boat will appear transparent due to the fact that you put it inside the character. Trying zooming out and looking for the boat.

function unanchor(a)
	for _,Part in pairs(Boat:GetChildren()) do
		if Part:IsA("BasePart") then --If the object is a Part, Wedge, CornerWedge, or Union then...
			Part.Anchored = false
		end
		unanchor(Part) --Check inside each model and part for any parts.
	end
end

game.Players.PlayerAdded:connect(function(plr)
        plr.CharacterAdded:connect(function(char)
		local tors = char:WaitForChild('Torso') --tors is the character's Torso
		local Boat = workspace.Boat:Clone() --Define backpack as a part
		unanchor(Boat)
		local weld = Instance.new('Weld',tors) --Create a new weld object inside tors
		weld.Part0 = tors --A weld needs 2 parts to funciton, this is one of them
		weld.Part1 = Boat.Part --This is the other one
		weld.C0 = CFrame.new(0,0,0)
		Boat.Parent = char --Parent it to the character
	end)
end)

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