Don't know how to make hitbox for attack and not sure how to make slide

I don’t recommend using that code. I would use this:

    mouse.Button1Down:Connect(function()
    	if character:FindFirstChild("DemonFlip") and Cooldown.Value == false then
    		Cooldown.Value = true
    		local sound = Instance.new("Sound", game.Players.LocalPlayer)
    		sound.SoundId = "rbxassetid://5355789788"
    		local BodyVelo = Instance.new("BodyVelocity")
            BodyVelo.Velocity = character.HumanoidRootPart.CFrame.lookVector * 10
    		BodyVelo.MaxForce = Vector3.new(15000,15000,15000)
            BodyVelo.Parent = character.HumanoidRootPart
    		sound:Play()
    		lolanimation:Play()
    		lolanimation.Stopped:wait()
    		BodyVelo:Destroy()
    		sound:Destroy()
    	end
    end)

https://streamable.com/m9wum7 This is the issue. I want it to turn around as I turn.

Your character is turning around tho?

I want the sliding to continue on the new direction i’m facing, to clear that up

Try welding a hitbox. For example weld a part into his arm and when that part is touched magic!

1 Like

I recommend weld constraints because they don’t need a c0 or c1 just a part 1.

This is what your code should be:

local P = game.ReplicatedStorage.HitBox:Clone()
P.Parent = Player.Character["Right Arm"]
P.CFrame = Player.Character['Right Arm"].CFrame * CFrame.new(0,-1.3,0)
P.Anchored = false
P.CanCollide = false
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Player.Character["Right Arm']
Weld.Part1 = P
Weld.Parent = Weld.Part0
P.Touched:Connect(function(hit)

end) 

This is just the way I weld so!

1 Like

Oh, I see. You want the character to be able of moving while also being forced to keep moving. Then you shouldn’t use bodymovers. I’m not quite sure on how to do that either.

1 Like

Do if you click on W A S or D then destroy the velocity!

I appreciate the help for the hitbox! For my slide, I’m trying to replicate something like this,
https://www.youtube.com/watch?v=D40OoId4KTw&ab_channel=xSoloGuy&t=96 .
making them able to turn around, but they still have the velocity. I have timestamped the video. Also, I would like to activate the hitbox when a GetMarkerReachedSignal is reached, so it can hit up to 4 different times.

He isn’t using controls he is moving with shiftlock by rotating himself.

local BV = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart)
BV.MaxForce = Vector3.new(1,1,1) * math.huge
BV.Velocity = Player.Character.HumanoidRootPart.CFrame.LookVector * 30
game.Debris:AddItem(BV,--The Time you want it to stay)

Whenever you shift lock it will move you towards this bodyvelocity.

Still keeps me moving in 1 direction
image

local Player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local character =Player.Character or Player.CharacterAdded:wait()
local Cooldown = Instance.new("BoolValue", game.Players.LocalPlayer)
Cooldown.Value = false
local Humanoid = character:WaitForChild("Humanoid")
local animator = Humanoid:FindFirstChildOfClass("Animator")
local Mouse = Player:GetMouse()
local m1 = Instance.new("Animation")
local Debounce = false
local DebounceTimer = 6
m1.AnimationId = "rbxassetid://5945839988"
local m2 = Instance.new("Animation")
m2.AnimationId = "rbxassetid://5949219966"
	local animationTrack = animator:LoadAnimation(m2)
	local lolanimation = animator:LoadAnimation(m1)


local tool = script.Parent.Parent.DemonFlip
local mouse = Player:GetMouse()
mouse.Button1Down:Connect(function()
	if character:FindFirstChild("DemonFlip") and Cooldown.Value == false then
		Cooldown.Value = true
		local BV = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart)
		local sound = Instance.new("Sound", game.Players.LocalPlayer)
		sound.SoundId = "rbxassetid://5355789788"
			Humanoid.WalkSpeed = 0
		BV.MaxForce = Vector3.new(1,1,1) * math.huge
		BV.Velocity = Player.Character.HumanoidRootPart.CFrame.LookVector * 30
			sound:Play()
		lolanimation:Play()
		lolanimation.Stopped:wait()
		BV:Destroy()
		sound:Destroy()
	end
end)	

	
mouse.Button2Down:Connect(function()
		if character:FindFirstChild("DemonFlip") and Cooldown.Value == false then
		Cooldown.Value = true
		local sound = Instance.new("Sound", game.Players.LocalPlayer)
		sound.SoundId = "rbxassetid://5355789788"
		local runtrack = Humanoid:LoadAnimation(m2)
		local BV2 = Instance.new("BodyVelocity",Player.Character.HumanoidRootPart)
		sound:Play()
		animationTrack:AdjustSpeed(1.5)
		animationTrack:Play()
		animationTrack:AdjustSpeed(1.5)
		Humanoid.WalkSpeed = 0
		BV2.MaxForce = Vector3.new(1,1,1) * math.huge
		BV2.Velocity = Player.Character.HumanoidRootPart.CFrame.LookVector * 30
		animationTrack.Stopped:wait()
		BV2:Destroy()
		animationTrack:AdjustSpeed(1)
		Humanoid.WalkSpeed = 16
		sound:Destroy()
		end
end)
Cooldown.Changed:Connect(function()
	if Cooldown.Value == true then
		wait(5)
		Cooldown.Value = false
	end
		end)

Back, actually… don’t put a parent argument in the instance, it makes instances more delayed to appear, you should add a parent instead like “part.Parent = game.Workspace” instead of “Instance.new(“Part”, humanoidRootPart)”.

Anyways, my bad if i didn’t explain right, the P property of the body velocity is the power meaning since you put 0, it wouldn’t be powered enough to move the humanoid root part to where it’s supposed to be, the max force should be “0, math.huge, 0” so you can move horizontally but not vertically like in Rogue Lineage.

Also since the velocity i put wasn’t updated meaning it would only go to the original direction your humanoid root part was facing and not the current rotation your humanoid root part was, you should make a new thread local connection = spawn(function() then make the humanoid root part move by 0.5 studs or lesser but faster if you want it to be smoother on the Z direction (front) and put it in a loop until it gets disconnected.

Make sure that after around 3 seconds, you should disconnect it like connection:Disconnect() so it won’t happen infinitely.

1 Like

Could you make an example in my code? Appreciate the help, though

Okay i will, it’ll take 10 minutes but i’ll show you the details that are going to happen in the script later i post the example i provide.

1 Like

I created an example in a model, you could use it for anything especially for the demon flip issue you have been having, make sure to edit some stuff so it doesn’t cause some problems.

Or if you’re too lazy to get the model, you can examine this code.

local part = script.Parent
local speed = .25
local canMove = true

local model = part.Parent
local target = model:WaitForChild("target")

local connection = spawn(function()
	if canMove == true then
		repeat
			part.CFrame = CFrame.new(part.Position + part.CFrame.lookVector * speed)
			part.CFrame = CFrame.new(part.Position, target.Position)
			game:GetService("RunService").Heartbeat:Wait()
		until canMove == false
	end
end)

wait(10)

canMove = false

It doesn’t work, probably because I haven’t worked with CFrame much and I probably made a mistake somewhere.

local Player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local character =Player.Character or Player.CharacterAdded:wait()
local Cooldown = Instance.new("BoolValue", game.Players.LocalPlayer)
Cooldown.Value = false
local Humanoid = character:WaitForChild("Humanoid")
local animator = Humanoid:FindFirstChildOfClass("Animator")
local Mouse = Player:GetMouse()
local m1 = Instance.new("Animation")
local Debounce = false
local DebounceTimer = 6
m1.AnimationId = "rbxassetid://5945839988"
local m2 = Instance.new("Animation")
m2.AnimationId = "rbxassetid://5949219966"
	local animationTrack = animator:LoadAnimation(m2)
	local lolanimation = animator:LoadAnimation(m1)
local canMove = false
local model = character.HumanoidRootPart
local speed = 8

local connection = spawn(function()
	if canMove == true then
		repeat
			character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.lookVector * speed)
			character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position, character.HumanoidRootPart.Position)
			game:GetService("RunService").Heartbeat:Wait()
		until canMove == false
	end
end)

wait(10)

canMove = false


local tool = script.Parent.Parent.DemonFlip
local mouse = Player:GetMouse()
mouse.Button1Down:Connect(function()
	if character:FindFirstChild("DemonFlip") and Cooldown.Value == false then
		Cooldown.Value = true
		local sound = Instance.new("Sound", game.Players.LocalPlayer)
		sound.SoundId = "rbxassetid://5355789788"
			Humanoid.WalkSpeed = 0
			sound:Play()
		lolanimation:Play()
		lolanimation.Stopped:wait()
		BV:Destroy()
		sound:Destroy()
	end
end)	

	
mouse.Button2Down:Connect(function()
		if character:FindFirstChild("DemonFlip") and Cooldown.Value == false then
		Cooldown.Value = true
		local sound = Instance.new("Sound", game.Players.LocalPlayer)
		sound.SoundId = "rbxassetid://5355789788"
		local runtrack = Humanoid:LoadAnimation(m2)
		sound:Play()
		animationTrack:AdjustSpeed(1.5)
		animationTrack:Play()
		animationTrack:AdjustSpeed(1.5)
		Humanoid.WalkSpeed = 0
		canMove = true
		spawn()
		animationTrack.Stopped:wait()
		canMove = false
		animationTrack:AdjustSpeed(1)
		Humanoid.WalkSpeed = 16
		sound:Destroy()
		end
end)
Cooldown.Changed:Connect(function()
	if Cooldown.Value == true then
		wait(5)
		Cooldown.Value = false
	end
		end)

Actually, it’s a thread, not a function, anyways…

You should put that connection thing inside the button1down function instead and then make canMove to false after.

I don’t really understand, what do you mean?

Spawn(function() is a new thread so it doesn’t have to complete for the next code to begin, do what i said earlier and you’ll understand it.


On clicking I get taken into some weird area

local Player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local character =Player.Character or Player.CharacterAdded:wait()
local Cooldown = Instance.new("BoolValue", game.Players.LocalPlayer)
Cooldown.Value = false
local Humanoid = character:WaitForChild("Humanoid")
local animator = Humanoid:FindFirstChildOfClass("Animator")
local Mouse = Player:GetMouse()
local m1 = Instance.new("Animation")
local Debounce = false
local DebounceTimer = 6
m1.AnimationId = "rbxassetid://5945839988"
local m2 = Instance.new("Animation")
m2.AnimationId = "rbxassetid://5949219966"
	local animationTrack = animator:LoadAnimation(m2)
	local lolanimation = animator:LoadAnimation(m1)
local canMove = false
local model = character.HumanoidRootPart
local speed = 0.25

local connection = spawn(function()
	if canMove == true then
		repeat
			character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.lookVector * speed)
			character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position, character.HumanoidRootPart.Position)
			game:GetService("RunService").Heartbeat:Wait()
		until canMove == false
	end
end)

wait(10)

canMove = false


local tool = script.Parent.Parent.DemonFlip
local mouse = Player:GetMouse()
mouse.Button1Down:Connect(function()
	if character:FindFirstChild("DemonFlip") and Cooldown.Value == false then
		Cooldown.Value = true
		local sound = Instance.new("Sound", game.Players.LocalPlayer)
		sound.SoundId = "rbxassetid://5355789788"
			Humanoid.WalkSpeed = 0
			sound:Play()
		lolanimation:Play()
		canMove = true
		local connection = spawn(function()
			if canMove == true then
				repeat
					character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.lookVector * speed)
					character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position, character.HumanoidRootPart.Position)
					game:GetService("RunService").Heartbeat:Wait()
				until canMove == false
				lolanimation.Stopped:wait()
				Humanoid.WalkSpeed = 16
				canMove = false
		sound:Destroy()
	end
		end)
	end
end)


	
mouse.Button2Down:Connect(function()
		if character:FindFirstChild("DemonFlip") and Cooldown.Value == false then
		Cooldown.Value = true
		local sound = Instance.new("Sound", game.Players.LocalPlayer)
		sound.SoundId = "rbxassetid://5355789788"
		local runtrack = Humanoid:LoadAnimation(m2)
		sound:Play()
		animationTrack:AdjustSpeed(1.5)
		animationTrack:Play()
		animationTrack:AdjustSpeed(1.5)
		Humanoid.WalkSpeed = 0
		animationTrack.Stopped:wait()
		animationTrack:AdjustSpeed(1)
		Humanoid.WalkSpeed = 16
		sound:Destroy()
		end
end)
Cooldown.Changed:Connect(function()
	if Cooldown.Value == true then
		wait(5)
		Cooldown.Value = false
	end
		end)