Im making a dash attack that brings the hitplayer along with the player doing the dash
Here a video, the left side of the screen is the player getting hit by the dash, and on the right side of the screen is the player doing the dash
The issue is that on the left screen there a weird flicker effect after the dash ends how would I fix this?
I believe its a network ownership issue, whenever the dash hits the hitplayer it sets that player ownership to the player doing the dash
When trying to do the dash on server it barely pushes anyone, and trying to make the force local to the player being hit causes the hitplayer to fall way behind
Is there any solution im not thinking of that could fix this?
Here the code if that matters
if Result == "Hit" then
if Victim and Player then
if Victim.PrimaryPart and Victim.PrimaryPart.Anchored == false then
Utility:SetNetworkOwnerOnModel(Victim, Player) -- This to ensure the force is playing smoothly and accurately
end
end
--CombatService:StunAnim(Victim)
--CombatService:RemoveBodyMovers(Victim)
--CombatService:RemoveBodyMovers(Character)
coroutine.wrap(function()
if not Attach then return end
local Attach2 = Instance.new("Attachment",Victim.PrimaryPart)
if VictimPlayer then
--self:GetBehaviorSequence():Fire("VFX",Players:GetPlayerFromCharacter(Victim),Character,"PlayerForce2",Attach2,Attach)
else
end
local Linear = Instance.new("AlignPosition",Attach2)
Linear.ForceLimitMode = Enum.ForceLimitMode.PerAxis
Linear.MaxAxesForce = Vector3.new(10e4,10e4,10e4)
Linear.Attachment0 = Attach2
Linear.Mode = Enum.PositionAlignmentMode.TwoAttachment
Linear.Attachment1 = Attach
Linear.Responsiveness = 200
Linear.ReactionForceEnabled = false
Debris:AddItem(Attach2,Duration - ( workspace:GetServerTimeNow() - Start))
task.delay(Duration, function()
if VictimPlayer then
task.wait(0.5)
Utility:SetNetworkOwnerOnModel(Victim, VictimPlayer)
end
end)
end)()
end
local Character = 1
local Enemy = 2
local Holder = Character
local Victim = Enemy
local victimHRP = Victim:FindFirstChild("HumanoidRootPart")
local victimHumanoid = Victim:FindFirstChild("Humanoid")
local attachingCharacter = coroutine.wrap(function()
local networkOwner = Holder
local baseLimb = Holder:FindFirstChild("HumanoidRootPart") -- whatever you want weld
local attachWeld = script:FindFirstChild("Front Grab"):Clone()
local holdDuration = 1
for i, v in pairs(victimHRP:GetChildren()) do
if v:IsA("BodyMover") and not v:FindFirstChild("Important") and v.Name ~= "Uppercut Locked Position" and v.Name ~= "Mobile Shiftlock" and v.Name ~= "Locked Gyro" then
v:Destroy()
end
end
if game.Players:GetPlayerFromCharacter(Holder) then
networkOwner = game.Players:GetPlayerFromCharacter(Holder)
end
for i, v in pairs(Victim:GetDescendants()) do
if v:IsA("BasePart") then
if not v:GetAttribute("prevMassless") and not v:GetAttribute("prevCollision") then
v:SetAttribute("prevMassless", v.Massless)
v:SetAttribute("prevCollision", v.CollisionGroup)
end
v.Massless = true
v.CollisionGroup = "Uninteractable"
end
end
victimHRP.Massless = true
victimHRP:SetNetworkOwner(networkOwner)
victimHumanoid.PlatformStand = true
attachWeld.Name = "Character Attached"
attachWeld.Parent = victimHRP
attachWeld.Part0 = baseLimb
attachWeld.Part1 = victimHRP
wait(holdDuration)
warn("stopped holding")
if attachWeld.Parent ~= nil then
attachWeld:Destroy()
end
if Victim.Parent ~= nil then
local networkOwner = Victim
if game.Players:GetPlayerFromCharacter(Victim) then
networkOwner = game.Players:GetPlayerFromCharacter(Victim)
end
for i, v in pairs(Victim:GetDescendants()) do
if v:IsA("BasePart") and v:GetAttribute("prevCollision") then
v.Massless = v:GetAttribute("prevMassless")
v.CollisionGroup = v:GetAttribute("prevCollision")
end
end
victimHRP.Massless = false
victimHRP:SetNetworkOwner(networkOwner)
victimHumanoid.PlatformStand = false
victimHumanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)
attachingCharacter()