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

Anyone know why this weld script isn't working?

Player.script.Parent.Parent
c = Player.Character
game.Players.PlayerAdded:connect(function(plr)
		x = Instance.new("Part")
		x.Size = Vector3.new(1, 3, 1)
		x.TopSurface = "Smooth"
		x.BrickColor = BrickColor.new("Mid gray")
		x.Reflectance = 0.3
		x.Parent = c
		game.Debris:AddItem(x, 5)
		w1 = Instance.new("Weld", c)
		w1.Part0 = w1.Parent["Right Arm"]
		w1.Part1 = x
		w1.c1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) * CFrame.new(0, 0, 0)
		
		
end)

It's meant to execute the weld when a player joins the server, but it doesn't work.

1 answer

✓ Accepted answer

1 What is Player.script.Parent.Parent, at the top of that script, supposed to refer to?

2 Why are you referring to Player.Character outside the function that detects when Players enter?

3 A Weld's Parent property has to be set to the same Part that its Part0 property is.

4 c1 is not a valid property of a Weld Instance - properties, functions, methods, and variables are all case-sensitive. It should be C1.

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(c)
     		x = Instance.new("Part")
        	x.Size = Vector3.new(1, 3, 1)
        	x.TopSurface = "Smooth"
        	x.BrickColor = BrickColor.new("Mid gray")
        	x.Reflectance = 0.3
        	x.Parent = c
        	game.Debris:AddItem(x, 5)
			arm = c["Right Arm"]
        	w1 = Instance.new("Weld", arm) --Setting the Parent to "arm"
        	w1.Part0 = arm --Also setting the Part0 to "arm"
        	w1.Part1 = x
        	w1.C1 = CFrame.new() --Setting C1, not "c1".
	end)
end)

Edit: Note that, by default, C0 and C1 are both equal to the CFrame identity, i.e. (0,0,0,0,0,0,0,0,0,0,0,0)

1 comment

0

Would you know how to have it so that you could remove this "Part" through a gui. Cause I tried this and it didn't work...

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