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

Help with weld script?

When a player joins, they should have the part stuck to them. There is no weld in the part either.

local Part = script.Parent

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		local Torso = char:WaitForChild("Torso")
		local Weld = Instance.new("Weld")
		Weld.Part0 = Torso
		Weld.C0 = Torso.CFrame:inverse()
		Weld.Part1 = Part
		Weld.C1 = Part.CFrame:inverse()
		Weld.Parent = Part
		Part.Anchored = false
	end)
end)

2 comments

0

Do you think it's getting stuck on the WaitForChild?

0

Not sure.

1 answer

Here is an example of what you are trying to do. Play around with positioning, for the purpose of this it is named shieldpart.

--PUT THIS IN STARTER GUI, SHOULD BE A LOCALSCRIPT

wait()

player = game.Players.LocalPlayer
character = player.Character
leftarm = character["Left Arm"]

shieldpart = game.Workspace.Shield
local shield = shieldpart.ShieldHandle

if shieldpart.Parent ~= character then
shieldpart.Parent = character

local weld = Instance.new("Weld", shield)
weld.Part0 = leftarm
weld.Part1 = shield
weld.C0 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0,0,0)
end

2 comments

0

I don't want a local script.

0

Why? Just make a parent script and clone the script into the players starter pack if it means that much

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