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

how do remove the weld? (solved)

i cant remove the weld when i trigger the ProximityPrompt

local Anim = script:WaitForChild("Animation")
script.Parent.ProximityPrompt.Triggered:Connect(function(player)	
	local hum = player.Character:WaitForChild("Humanoid")
	local loadAnim = hum.Animator:LoadAnimation(Anim) -- loads animation	
	local length = (player.Character.HumanoidRootPart.Position - script.Parent.Position).Magnitude	
	local char = player.Character or player.CharacterAdded:Wait()
	local weld = Instance.new("WeldConstraint")

	if workspace.itilenkontrol.Transparency == 0 then
		print("a")
		workspace.itilenkontrol.Transparency = 1
		weld.Parent = char
		weld.Part0 = script.Parent	
		weld.Part1 = char.HumanoidRootPart
		script.Enabled = false
		wait(0.01)
		script.Enabled = true
	else
		print("b")
		workspace.itilenkontrol.Transparency = 0
		weld:remove()
		script.Enabled = false
		wait(0.01)
		script.Enabled = true
	end
end)

1 comment

0

i fixed it so i do not need help anymore

3 answers

Try

Weld:Destroy()

Hope this helps!!

1 comment

0

destroy and remove are working and there is no error output but part still being welded to player

I don't think you can enable a script after disabling it, so I don't think the weld is being destroyed

1 comment

0

thats reload the script and there is no problem with it

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