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

Script is supposed to attach torso to block but it dosent work despite no errors in output?

CODE:

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
local Part = Char:WaitForChild("HumanoidRootPart") 
local Weld = Instance.new("Weld", Char)
Part.position = Vector3.new(script.Parent.Knife.Position)
script.Parent.Knife.CFrame = Part.CFrame
Weld.Part0 = script.Parent.Knife
Weld.Part1 = Part
Weld.C0 = Part.CFrame:inverse()
Weld.C1 = script.Parent.Knife.CFrame:inverse()
end)
end)


So basically what it does is make a wield from the players torso to a block so that way the torso is always attached to the block

2 comments

1

If it doesn't do what it's supposed to, what does it do instead?

0

Works for me..

1 answer

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:wait()
	plr.Character.Humanoid.HealthChanged:Connect(function()
		if plr.Character.Humanoid.Health <= 0
		then
			print("ded")
			game.Model.Knife.WeldConstraint:Destroy() --[[Instead of Model, write the searched Model]]
		end
	end)
end)

Your request was a script that breaks the weldconstraint when the player dies, here you go

1 comment

0

you can instance a new constraint if you need one

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