generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Problem with welding

Previous Thread :: Next Thread 
CrowClaws is not online. 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 is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
27 Apr 2015 06:58 PM
pls help
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
27 Apr 2015 07:07 PM
bb
Report Abuse
Casualist is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image