Trying to make a "Teleport Slash" ability

elseif Input_KeyCode == Action_Keybinds["Teleport_Slash"] then
		local Old_CFrame = character:GetPivot()
		
		if Teleport_Slash_ON_COOLDOWN == true or not character:FindFirstChild("ClassicSword") then return end
		Teleport_Slash_ON_COOLDOWN = true
		
		local Teleport_Slash_Animation_Track = Create_Animation_Track(Teleport_Slash_Animation)
		Teleport_Slash_Animation_Track:Play()
		
		Teleport_Slash_Animation_Track:GetMarkerReachedSignal("Teleport_Slash_Hit"):Once(function()
			local New_CFrame = character:GetPivot() * CFrame.new(0, 0, HRP.CFrame.LookVector * Teleport_Slash_MAX_RANGE)
			character:PivotTo(New_CFrame)
			
			local Teleport_Slash_Hitbox = Create_Teleport_Slash_Hitbox(Old_CFrame, New_CFrame)
			
			local Hit_Results = workspace:GetPartBoundsInBox(Teleport_Slash_Hitbox.CFrame, Teleport_Slash_Hitbox.Size, Hitbox_Parameters)
			
			if not Hit_Results then return end
			
			Validate_and_Damage_Enemy(Hit_Results, Teleport_Slash_DAMAGE, Teleport_Slash_Debounces)
		end)
local function Create_Teleport_Slash_Hitbox(Original_CFrame:CFrame, New_CFrame:CFrame)
	local Teleport_Slash_Hitbox = Instance.new("Part")
	Teleport_Slash_Hitbox.Anchored = true
	Teleport_Slash_Hitbox.CastShadow = false
	Teleport_Slash_Hitbox.CanTouch = false
	Teleport_Slash_Hitbox.CanCollide = false
	Teleport_Slash_Hitbox.Material = Enum.Material.Neon
	Teleport_Slash_Hitbox.Transparency = 0.65
	Teleport_Slash_Hitbox.Size = Vector3.new(4.1, 5.25, (New_CFrame.Position.Z - Original_CFrame.Position.Z))
	Teleport_Slash_Hitbox.Position = (New_CFrame.Position - Original_CFrame.Position) / 2 -- I don't know how to put it in the center of the animation
	Teleport_Slash_Hitbox.Parent = workspace
	
	return Teleport_Slash_Hitbox
end

Hello! I need help with pivotting the character to an animation position and I don’t know how to center the teleport slash’s hitbox to the center of it. Whenever I play the animation, the hitbox went to the origin (or somewhere around it) instead. I don’t know how to fix this. Any help is appreciated! :smiley:

1 Like

Bump! Still haven’t found a way or anything to do this :frowning:

Do you mean you want the character’s actual position to be where it is in the animation? To do this you have to move the humanoidrootpart with the character (because animations only move the torso, not rootpart)

And i found this module before but havent tried it

The hitbox cframe should be something like

local characterCFrame = character:GetPivot()
local hitboxCFrame = CFrame.lookAt(characterCFrame.Position, characterCFrame.Position + characterCFrame.LookVector) + characterCFrame.LookVector * hitboxLength/2

assuming character is the player’s character model and hitboxLength is the length (longest part which should be on the z axis) of the hitbox

I have never used another module created by another person. I’m kind of lost already :sweat_smile::sweat_smile:

get the model (and also available on github) https://create.roblox.com/store/asset/71017192895548/RootMotion-V11

go to toolbox > my models > click on it to insert into your game
store it somewhere in replicated storage probably under a folder

modules return one value and you can get the value by calling require(module), where module is a path to the module like ReplicatedStorage.modules.myModule

local RootMotion = require(ReplicatedStorage.lib.RootMotion)

and then read their api to figure out how to use it, i think you do something like this (from client side)

local Configuration = {
  AlignHRPCFrame = true,
  MaintainVelocity = true,
  Whitelist = {}, -- anything you would phase through here i think
} --// If left nil, the booleans will be assumed to be false

RootMotion:StartCorrection(Configuration)

-- then play the animation here


I just have this, I’m not sure lol