Break weld with script

uh so, i made a “build” that’s already unanchored and welded, and made a weld between it and a part, i wanted to make another part, with a proximity prompt, that when fired, that weld breaks, all the times i tried it didn’t work

1 Like
-- This is a simple Roblox script in Lua

-- Get the player
local player = game.Players.LocalPlayer

-- Function to handle when the player clicks
local function onClick()
    print("Button clicked!")
    -- Add your desired actions here
end

-- Create a button
local button = Instance.new("TextButton")
button.Parent = player.PlayerGui
button.Position = UDim2.new(0.5, 0, 0.5, 0)
button.Size = UDim2.new(0, 200, 0, 50)
button.Text = "Click me!"
button.MouseButton1Click:Connect(onClick)

This will need to be a server Script which is a child of the ProximityPrompt:

local Debris = game:GetService("Debris")

local prompt = script.Parent

local weld = -- Where the weld you want to destroy is

local function onTriggered()
	Debris:AddItem(weld, 0)
end

prompt.Triggered:Connect(onTriggered)