Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do remove the weld? (solved)

Asked by 2 years ago
Edited 2 years ago

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)
0
i fixed it so i do not need help anymore 410eren 6 — 2y

3 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Try

Weld:Destroy()

Hope this helps!!

0
destroy and remove are working and there is no error output but part still being welded to player 410eren 6 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

well i guess no one has the answer

Log in to vote
0
Answered by 2 years ago

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

0
thats reload the script and there is no problem with it 410eren 6 — 2y

Answer this question