|
| 03 Mar 2015 10:18 AM |
If any part touches it, it would automatically weld itself to it. Is there any possible way to achieve this?
|
|
|
| Report Abuse |
|
|
|
| 03 Mar 2015 10:20 AM |
Yes, there is a possible way to achieve this.
⬡ |
|
|
| Report Abuse |
|
|
AnimeWiki
|
  |
| Joined: 26 Oct 2014 |
| Total Posts: 460 |
|
|
| 03 Mar 2015 10:26 AM |
@DeviousDeviation
Really helpful..
a = Instance.new("Part", workspace) -- for testing deb = false
a.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and game:GetService("Players"):FindFirstChild(hit.Parent.Name) ~=nil and deb == false then deb = true local weld = Instance.new("Weld", hit) weld.Part0 = hit.Parent:FindFirstChild("Humanoid") weld.Part1 = a
end end)
|
|
|
| Report Abuse |
|
|
AnimeWiki
|
  |
| Joined: 26 Oct 2014 |
| Total Posts: 460 |
|
|
| 03 Mar 2015 10:27 AM |
whoops i make easy mistake..
a = Instance.new("Part", workspace) -- for testing deb = false
a.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and game:GetService("Players"):FindFirstChild(hit.Parent.Name) ~=nil and deb == false then deb = true local weld = Instance.new("Weld", hit) weld.Part0 = hit.Parent:FindFirstChild("Humanoid") weld.Part1 = a wait(1) deb = false end end) |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2015 10:29 AM |
function Weld(b, a, parent) local c = Instance.new("Weld") c.Part0 = a c.Part1 = b c.C0 = a.CFrame:inverse() * CFrame.new(a.Position) c.C1 = b.CFrame:inverse() * CFrame.new(a.Position) c.Parent = (not parent and game.JointsService) or parent return c end
This function takes two parts as arguments and will attach them together in their current positions. You don't need to supply a parent argument, but you can if you like. |
|
|
| Report Abuse |
|
|
AnimeWiki
|
  |
| Joined: 26 Oct 2014 |
| Total Posts: 460 |
|
|
| 03 Mar 2015 10:29 AM |
| weld.Part0 = hit -- not humanoid sorry. |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2015 10:54 AM |
| Thanks. Was really helpful. |
|
|
| Report Abuse |
|
|