CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 27 Apr 2015 06:51 PM |
local function weldBetween(a, b) local weld = Instance.new("ManualWeld", a) weld.Part0 = a weld.Part1 = b weld.C0 = a.CFrame:inverse() * b.CFrame return weld end
local Effect = function(position,BrickColor,hit) local Blood = Instance.new("Folder", workspace) Blood.Name = 'Blood' local Drop = Instance.new("Part",Blood) Drop.FormFactor = 'Custom' Drop.Size = Vector3.new(.2,.2,.2) Drop.BackSurface = 'Smooth' Drop.BottomSurface = 'Smooth' Drop.FrontSurface = 'Smooth' Drop.LeftSurface = 'Smooth' Drop.RightSurface = 'Smooth' Drop.TopSurface = 'Smooth' Drop.CanCollide = false Drop.CFrame = CFrame.new() + position local Mesh = Instance.new("BlockMesh",Drop) Mesh.Scale = Vector3.new(.5,.5,.5) Drop.BrickColor = BrickColor Drop.CFrame = CFrame.new() + position local weld = weldBetween(hit,Drop) --local weld = weldBetween(Drop,hit) tried this as well wait(2) weld:Destroy() Blood:Destroy() end
K this is just part of the script. It's the part where i am having troubles. All the variables are defeind blah blah balh. I am just trying to get this small part to "weld" to hit. But when I run this function (part of a gun) the part moves to the drop instead of visa versa |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
| |
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
| |
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 27 Apr 2015 07:14 PM |
local function weldBetween(a, b) local weld = Instance.new("ManualWeld", a) weld.Part0 = a weld.Part1 = b --//Now that both Part0 and Part1 are defined, and weld is parented weld will act on a and b with it's currently defined C0 and C1 values. The default is C0 == C1 == CFrame.new() --// hence for the equal Part0.CFrame*C0 == Part1.CFrame*C1 to be valid Part0.CFrame must equal Part1.CFrame weld.C0 = a.CFrame:inverse() * b.CFrame return weld end
How to fix: local function weldBetween(a, b) local weld = Instance.new("ManualWeld") weld.Part0 = a weld.Part1 = b weld.C0 = a.CFrame:inverse() * b.CFrame weld.Parent = a --// parenting after redefining all values should fix the issue return weld end
local function weldBetween(a, b) local weld = Instance.new("ManualWeld", a) weld.C0 = a.CFrame:inverse() * b.CFrame --//I personally like to define C0 and C1 first weld.Part0 = a weld.Part1 = b return weld end |
|
|
| Report Abuse |
|
|
CrowClaws
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 27 Apr 2015 10:45 PM |
Cas you are the best.
There's another issue.
When the drop is attached to an unanchored part it freezes the part. It's no longer unanchored. Is there a way to prevent this? |
|
|
| Report Abuse |
|
|