Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

The move keeps forcing the player to go up, even thought Its suppose to go down (?)

As the title says, there Is a move (a tool without a handle) under an NPC, upon activation, the NPC will slash there sword, on contact It will deal damage towards enemies (while making the player and the vicitim rise up) then a final blow, dealing massive about of damage, the problem Is that It keeps forcing the player to go up, and If the vicitim does not die, they stay Idle, but not moving up, help!

Script:

local Tool = script.Parent
local CanDamage = false
local Debounce = false

Tool.Activated:Connect(function()
	if not Debounce then
		Debounce = true
		CanDamage = true
		Tool.SwordSlash:Play()
		local Anim = Tool.Parent.Humanoid:FindFirstChild("Animator"):LoadAnimation(Tool.Animation)
		Anim:Play()
		wait(2)
		Debounce = false
		CanDamage = false
	end
end)

Tool.Parent.Sword.Touched:Connect(function(hit)
	local Humanoid = hit.Parent:WaitForChild("Humanoid")
	if Humanoid.Name == "Stonk Troll" and Humanoid then
		Humanoid.Parent.HumanoidRootPart.Anchored = true
		Tool.Parent.HumanoidRootPart.Anchored = true
		for i=0, 3 do
			Tool.SwordSlash:Play()
			Humanoid:TakeDamage(30)
			Humanoid.Parent.HumanoidRootPart.Position = Humanoid.Parent.HumanoidRootPart.Position + Vector3.new(0,10,0)
			Tool.Parent.HumanoidRootPart.Position = Tool.Parent.HumanoidRootPart.Position + Vector3.new(0,10,0)
			wait(1)
		end
		wait(0.1)
		Humanoid:TakeDamage(10000)
		Humanoid.Parent.HumanoidRootPart.Anchored = false
		Tool.Parent.HumanoidRootPart.Anchored = false
		CanDamage = false
	else
		if Humanoid and CanDamage == true and Humanoid.Parent.IsMetal.Value == false then
			Humanoid.Parent.HumanoidRootPart.Anchored = true
			Tool.Parent.HumanoidRootPart.Anchored = true
			for i=0, 3 do
				Tool.SwordSlash:Play()
				Humanoid:TakeDamage(53)
				Humanoid.Parent.HumanoidRootPart.Position = Humanoid.Parent.HumanoidRootPart.Position + Vector3.new(0,10,0)
				Tool.Parent.HumanoidRootPart.Position = Tool.Parent.HumanoidRootPart.Position + Vector3.new(0,10,0)
				wait(1)
			end
			wait(0.1)
			Humanoid:TakeDamage(100)
			Humanoid.Parent.HumanoidRootPart.Anchored = false
			Tool.Parent.HumanoidRootPart.Anchored = false
			CanDamage = false
		elseif Humanoid and CanDamage == true and Humanoid.Parent.IsMetal.Value == true then
			Humanoid.Parent.HumanoidRootPart.Anchored = true
			Tool.Parent.HumanoidRootPart.Anchored = true
			for i=0, 3 do
				Tool.SwordSlash:Play()
				Humanoid:TakeDamage(2)
				Humanoid.Parent.HumanoidRootPart.Position = Humanoid.Parent.HumanoidRootPart.Position + Vector3.new(0,10,0)
				Tool.Parent.HumanoidRootPart.Position = Tool.Parent.HumanoidRootPart.Position + Vector3.new(0,10,0)
				wait(1)
			end
			wait(0.1)
			Humanoid.Parent.HumanoidRootPart.Anchored = false
			Tool.Parent.HumanoidRootPart.Anchored = false
			Humanoid:TakeDamage(10)
			CanDamage = false
		end
	end
end)

Tool.Equipped:Connect(function()
	Tool.Unsheath:Play()
	Tool.Unequipped:Connect(function()
		Tool.Unsheath:Play()
	end)
end)

3 comments

0

i dont get what you mean perhaps a video?

0

made a tool that when apon activation, you will spins you around and then doing a final blow, If you hit a enemy thought, you and the enemy will float, before falling when u do ur final blow, the problem Is that It will keep on rising the player, even thought It did Its final blow, also If a enemy doesn't die, they get stuck midair

0

Try using + Vector3.new(0, -10, 0) the negative makes it go the opposite direction.

2 answers

Your positioning could be wrong try getting rid of 10, and changing the 3rd or 1st 0 to 10 to see if that would work. Make sure your tool isn't anchored or weld to anything!!

1 comment

0

"Make sure your tool Isn't weld or anchored" Have you read the description of the title, but then still, thanks!

May seem off-topic, as I didn't quite understand what you mean, but If its going down instead of up, try making the number negative.

If you try making it like 6 but it goes down or smth, just mae it -6

SORRY IF THIS IS OFF-TOPIC... :C

This discussion is preserved as it was. New answers, comments, and votes are closed.