I want to make the players I hit actually track the spot in front of the attacker for a duration, here’s what it looks like on dummies as opposed to players:
[Watch 1cc8f07d-1497-4069-880c-361217887c21-render | Streamable]
I’ve tried using different instances to attach the player/dummy such as WeldConstraints and AlignPosition + AlignOrientation but I guess there’s still something I’m doing wrong
Here is the code that I use for creating grabs that is within a ModuleScript:
local rs = game:GetService("RunService")
local players = game:GetService("Players")
local ss = game:GetService("ServerStorage")
local rp = game:GetService("ReplicatedStorage")
local serverModules = ss.Modules
local charMod = require(serverModules.Character)
local clientModules = rp.Modules
local attributeMod = require(clientModules.Attributes)
local module = {}
module.__index = module
module.grabs = {}
function module.start(owner:Player, char1:Model, char2:Model, pos:Vector3, rot:Vector3, maxDistance:number)
if not char1 or not char2 then return end
local root1, root2 = char1:FindFirstChild("HumanoidRootPart"), char2:FindFirstChild("HumanoidRootPart")
if not root1 or not root2 then return end
local root2attachment = root2:FindFirstChild("RootAttachment")
if not root2attachment then return end
local owner2 = players:GetPlayerFromCharacter(char2) or nil
local hum = char2:FindFirstChild("Humanoid")
if not hum then return end
owner = owner or nil
pos = pos or Vector3.new(0,0,0)
maxDistance = maxDistance or 30
hum.PlatformStand = true
if (root2.Position - (root1.CFrame * CFrame.new(pos)).Position).Magnitude >= maxDistance then
root2.CFrame = root1.CFrame * CFrame.new(pos) * CFrame.Angles(math.rad(rot.X), math.rad(rot.Y), math.rad(rot.Z))
end
local previousGrabTable = module.grabs[char2]
local a1,ap,ao = nil,nil,nil
if previousGrabTable then
attributeMod.remove(char2, "noRotation", 1)
a1 = previousGrabTable.a1
ap = previousGrabTable.ap
ao = previousGrabTable.ao
else
a1 = Instance.new("Attachment",root1)
a1.Position = pos
a1.Orientation = rot
ap = Instance.new("AlignPosition",a1)
ap.MaxForce = 1e9
ap.Responsiveness = 500
ap.RigidityEnabled = true
ap.ReactionForceEnabled = false
ap.Attachment0 = root2attachment
ap.Attachment1 = a1
ao = Instance.new("AlignOrientation",a1)
ao.MaxTorque = 1e9
ao.Responsiveness = 500
ao.RigidityEnabled = true
ao.ReactionTorqueEnabled = false
ao.Attachment0 = root2attachment
ao.Attachment1 = a1
end
charMod.setNetworkOwner(char2, owner)
charMod.setCollisionGroup(char2, "PlayerNoCol")
attributeMod.add(char2, "noRotation", 1, nil)
local tab = {
a1 = a1,
ao = ao,
ap = ap,
}
tab.destroy = function()
tab.a1:Destroy()
hum.PlatformStand = false
charMod.setNetworkOwner(char2, owner2)
charMod.setCollisionGroup(char2, "Player")
module.grabs[char2] = nil
attributeMod.remove(char2, "noRotation", 1)
end
if previousGrabTable then
table.clear(module.grabs[char2])
end
setmetatable(tab, module)
module.grabs[char2] = tab
return tab
end
return module
Any help is appreciated