hello i am making a game which uses abilitys and combat system and while scripting i got a lil tiny bit of an problem soo here i show you one video the first one which is not anchored on humanoid when ability catches enemy:
now this is when i anchor the primary part:
as you can see both are very weird and i am using welds! this is what i am trying to achive:
Whats the reason for using the WeldConstraint? if you could Anchor both PrimaryParts of the NPC and the Player in the required position?
I will suppose you want to keep moving the Player and the NPC by being welded it will follow the Player. But, why welding their Heads and not its PrimaryParts together?
sorry for late response um i used to weld the primary parts but i thought that was the problem soo i removed it and set it to the head, i use welds to keep them together. anchoring doesn’t work that good for me. i still haven’t figured out how to do this soo anyone else willing to help me?
… you gotta be patient… its not like the users of devforums gets paid for helping you…
I was busy, but, I tested your script.
Works fine for me, I created a silly quick animation of some punches, works as expected, everything works as expected.
I just, as I stated before, welded the PrimaryPart of both player and NPC, not their heads, and I tested it by welding the heads, and yes, it causes weird behavior, but with the primary parts it works fine.
Be sure the priority of your anims its at the max level, and perhaps you would wish to stop the AnimationTracks that are playing in the Character as default
I forgot to mention that I loaded the animation into the Animator not the Humanoid, cause its deprecated to do that:, try that, it could be the issue player.Character.Humanoid:WaitForChild("Animator"):LoadAnimation(script.Animation):Play()
And I uncommented some parts of your script to test it, cause I dont have the visuals and stuff, and Im lazy to create more animations, I just created one.
And I sent the rig directly to the function, not the part to be analized with PartsInBounds.
If it helps, this is the code I used:
--local replicatedstorage = game:GetService("ReplicatedStorage")
--local VFX = replicatedstorage.VFX
local blackFlash = {}
blackFlash.main = function(player, rig)--, partCframe, partSize)
local object = rig:WaitForChild("HumanoidRootPart")
--local WhitePartc2 = VFX.BLACKFLAS.WHITE2:Clone()
--WhitePartc2.Parent = player.Character.PrimaryPart
--local Attach = VFX.BLACKFLAS.Attachment:Clone()
--Attach.Parent = player.Character.PrimaryPart
--local LoadedAnim = player.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.ANIMATION.ABILITY.BLACKFLASH.BLACKFLASH)
--LoadedAnim:Play()
local BV = Instance.new("BodyVelocity", player.Character.HumanoidRootPart)
BV.MaxForce = Vector3.new(100000,100000,100000)
BV.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 35
wait(0.5)
BV:Destroy()
--WhitePartc2:Destroy()
--Attach:Destroy()
--local objectsInSpace = workspace:GetPartBoundsInBox(partCframe, partSize)
--for _, object in ipairs(objectsInSpace) do
--if object.Parent ~= player.Character and object.Parent:FindFirstChild("Humanoid") and object == object.Parent.PrimaryPart then
--print(objectsInSpace)
--print(object)
--local WhitePartc2 = VFX.BLACKFLAS.WHITE2:Clone()
--WhitePartc2.Parent = player.Character.PrimaryPart
--local WhitePart = VFX.BLACKFLAS.WHITE:Clone()
--WhitePart.Parent = player.Character.PrimaryPart
--LoadedAnim:Stop()
for _, Part in object.Parent:GetDescendants() do
if Part:IsA("BasePart") then
Part.CollisionGroup = "Entity2"
end
end
task.wait(0.1)
local weld = Instance.new("WeldConstraint")
weld.Part0 = player.Character.PrimaryPart
weld.Parent = player.Character
player.Character.Humanoid.WalkSpeed = 0
player.Character.Humanoid.JumpPower = 0
player.Character.Humanoid.AutoRotate = false
object.Parent.Humanoid.WalkSpeed = 0
object.Parent.Humanoid.JumpPower = 0
object.Parent.Humanoid.AutoRotate = false
local forwardVector = player.Character.PrimaryPart.CFrame.lookVector
local distance = 2
local offset = forwardVector * distance
local spawnPosition = player.Character.PrimaryPart.Position + offset
local directionToPlayer = (player.Character.PrimaryPart.Position - spawnPosition).unit
local rotation = CFrame.new(spawnPosition, spawnPosition + directionToPlayer)
object.Parent.PrimaryPart.CFrame = rotation
weld.Part1 = object.Parent.PrimaryPart
--local LoadedAnim2 = player.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.ANIMATION.ABILITY.BLACKFLASH.ATTACKFLASH)
--LoadedAnim2:Play()
--local LoadedAnim3 = object.Parent.Humanoid:LoadAnimation(game.ReplicatedStorage.ANIMATION.ABILITY.BLACKFLASH.TARGETFLASH)
--LoadedAnim3:Play()
player.Character.Humanoid:WaitForChild("Animator"):LoadAnimation(script.Animation):Play()
local humanoid = object.Parent:FindFirstChild("Humanoid")
--humanoid:TakeDamage(20)
object.Parent.PrimaryPart.CFrame = rotation
task.wait(3)
player.Character.Humanoid.WalkSpeed = 15
player.Character.Humanoid.JumpPower = 10
player.Character.Humanoid.AutoRotate = true
object.Parent.Humanoid.WalkSpeed = 15
object.Parent.Humanoid.JumpPower = 10
object.Parent.Humanoid.AutoRotate = true
object.Parent.PrimaryPart.Anchored = false
player.Character.PrimaryPart.Anchored = false
--WhitePartc2:Destroy()
--WhitePart:Destroy()
weld:Destroy()
--end
--end
end
--blackFlash.send = function(remote)
game.ReplicatedStorage:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player, target)--, partCframe, partSize)
blackFlash.main(player, target) --, partCframe, partSize)
end)
--end
return blackFlash