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

If I want to make a weld function, would this work?

Asked by 10 years ago

What I want it to do is when it touches a brick named Baseplate It'll weld itself to it.

Part = workspace.Part

function weldontouch(hit)
    if hit.Name == "Baseplate" then
        Glue = Instance.new("Weld", Part)
        Glue.Part0 = Part
        Glue.Part1 = hit
    end
end

script.Parent.Touched:connect(weldontouch)

1 answer

Log in to vote
0
Answered by 10 years ago

Put this script in baseplate, so whatever touches it, will weld itself to baseplate.

function onTouched(sadf)

local Glue = Instance.new("Weld")
Glue.Parent = script.Parent
Glue.Part0 = w1.Parent
Glue.Part1 = sadf
Glue.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) * CFrame.new(0, 0, 0)
end 

script.Parent.Touched:connect(onTouched)

I also tried your script. It didn't work.

Ad

Answer this question