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: Welding?

Previous Thread :: Next Thread 
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
27 May 2016 07:56 PM
Im trying to make a gamemode for my game where if you capture the flag you get an indicator above you so people know who has the flag... Here is my current system. How would i weld the block to the players head? In this method the part is slow.

part = Instance.new("Part", workspace)
mesh = Instance.new("SpecialMesh", part)
mesh.MeshId = "rbxassetid://9756362"
mesh.Scale = Vector3.new(2,3,2)
part.BrickColor = color
part.Anchored = true
part.CanCollide = false
part.Position = char.Head.Position + Vector3.new(0,4,0)
wait()
part:Destroy()
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
27 May 2016 08:42 PM
Bump.
Report Abuse
Waterlimon is not online. Waterlimon
Joined: 25 Apr 2009
Total Posts: 18821
27 May 2016 08:54 PM
You need to instance a "Weld" and set the properties correctly.
Then parent it to game.JointsService (where all welds go by default, though I think they work in workspace too, at least some welds do)

local w=Instance.new("Weld")
w.Part0=char.Head
w.Part1=part
w.C0 = CFrame.new(0,0,0) --A CFrame relative to Part0
w.C1 = CFrame.new(0,4,0) --A CFrame relative to C0
--Part1 is placed at C1, which is relative to C0 (this means it doesnt really matter whether you use C0 or C1 if the other is 0,0,0 - its like a + b, doesnt matter if a=5 b=0 or a=0 b=5 you get same result either way)
w.Parent=game.JointsService --IIRC theres some bug, that if you parent it before setting the properties, it wont work, so just to be sure im not parenting it in the Instance.new call


Then you can destroy the weld to detach.

I suggest writing a function for this so you can do stuff like
weld(part0,part1)
And have it automatically calculate C0 (or C1, doesnt matter) to be relative CFrame of the two parts (which is part0.CFrame:toObjectSpace(part1.CFrame))
Report Abuse
frriend is not online. frriend
Joined: 07 Feb 2010
Total Posts: 577
27 May 2016 09:04 PM
Ya learn something new every day! Thank you!
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