How do you weld an object to the character without causing movement issues?
I'm trying to create a melee weapon with a "damage radius" around the player. The welding however, causes the player to glitch out every time I use the weapon. Any help?
01 | local DamageObject = Instance.new( "Part" ) |
02 | DamageObject.Parent = workspace |
03 | DamageObject.Name = Player.Name.. "'s DamageObject" |
04 | DamageObject.Shape = Enum.PartType.Ball |
05 | DamageObject.Anchored = false |
06 | DamageObject.CanCollide = false |
07 | DamageObject.Size = Vector 3. new( 10 , 10 , 10 ) |
08 | DamageObject.Position = workspace [ Player.Name ] .UpperTorso.Position |
10 | local weld = Instance.new( "Weld" ) |
11 | weld.Parent = DamageObject |
13 | weld.Part 0 = workspace [ Player.Name ] .LowerTorso |
14 | weld.Part 1 = DamageObject |
15 | weld.C 0 = workspace [ Player.Name ] .UpperTorso.CFrame:Inverse() |
16 | weld.C 1 = DamageObject.CFrame:Inverse() |
18 | DamageObject.Touched:Connect( function (Part) |
19 | local Humanoid = Part.Parent:FindFirstChild( "Humanoid" ) |
20 | if Part.Parent:FindFirstChild( "Humanoid" ) and table.find(IgnoreList, Part.Parent.Name) = = nil then |
21 | if Part.Parent:FindFirstChild( "Died" ) = = nil then |
22 | ReplicatedStorage.DamageEvent:Fire(Player, Part.Parent.Humanoid, 25 ) |
23 | table.insert(IgnoreList, 1 , Part.Parent.Name) |
26 | if Humanoid.Health < = 0 then |
27 | local DeathMarker = Instance.new( "Folder" ) |
28 | DeathMarker.Name = "Died" |
29 | DeathMarker.Parent = Part.Parent |