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
|
  |
| Joined: 07 Feb 2010 |
| Total Posts: 577 |
|
| |
|
| 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
|
  |
| Joined: 07 Feb 2010 |
| Total Posts: 577 |
|
|
| 27 May 2016 09:04 PM |
| Ya learn something new every day! Thank you! |
|
|
| Report Abuse |
|