Make part back away from player until it touches something

im guessing that your trying to make a boss fight where one of his attack is to grab the player and throw him some where with out getting welded?

Yes except the player is the one that has the grab attack

if you dont mind, can you explain what does the player do with the grab attack?

The grab attack is just playing an animation on the player and the enemy, then when the animation is done, i want the enemy to fly backwards Welded to the mover part until the part touches something

you can anchored the humanoidRootPart of the enemy and make it so that they play the animation, while also checking if they are hitting any parts or not

Yes but i want him to also fly backwards

1 Like

Mainly you can make it so that if the humanoidrootpart is touching something using raycast function, then it unanchoreds and you can do the rest

fly backwards? can you explain it please

You know when you throw someone, I want him to get thrown away flying

1 Like

wait i might need to go, if you have time tomorrow i will contact you alright?

Okay you can contact me, Do you have Discord?

primalinfectedib in discord alright?

do you want to do something like this?

Yes! How did you do this? That looks just like what i imagined

1 Like

heres the script, instead of welding the humanoidRootPart the part and making the part move, you can use an old function called (“Body Vector”) which is seen in 2 scripts

Local Script (StarterPack)

local tool = script.Parent
local cooldown = false

script.Parent.Activated:Connect(function()
	if not cooldown then
		cooldown = true
		print("Actiavted")
		game.ReplicatedStorage.Reaaa:FireServer()
		wait(1)
		cooldown = false
	end
end)

ServerScriptService script

game.ReplicatedStorage.Reaaa.OnServerEvent:Connect(function(plr)
	print("Resevied")
	local part = Instance.new("Part")
	local any = false
	local cooldown = false
	local function HitPart(Hit, plrName)
		local c = false
		local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
		if Hit.Parent and Humanoid and Humanoid.Parent.Name ~= plrName then
			local humanoidParts = {}
			print("HUMANOID!!")
			any = true
			local HumanoidPart = Hit.Parent:FindFirstChild("HumanoidRootPart")
			local weld = Instance.new("WeldConstraint")

			for _, BodyPart in pairs(Humanoid.Parent:GetChildren()) do
				if BodyPart:IsA("BasePart") then
					BodyPart.CanCollide = false
					table.insert(humanoidParts, BodyPart)
				end
			end

			HumanoidPart.CFrame = plr.Character:FindFirstChild("RightHand").CFrame

			weld.Parent = HumanoidPart
			weld.Part0 = plr.Character:FindFirstChild("RightHand")
			weld.Part1 = HumanoidPart

			wait(3)
			weld:Destroy()
			for _, PartsParts in pairs(humanoidParts) do
				if PartsParts then
					PartsParts.CanCollide = true
				end
			end

			local bodyforce = Instance.new("BodyVelocity")
			bodyforce.MaxForce = Vector3.new(999999, 999999, 999999)
			bodyforce.Velocity = plr.Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * 80
			bodyforce.Parent = HumanoidPart

			while task.wait(0.1) do
				HumanoidPart.Touched:Connect(function(hit)
					if hit.Parent and not hit.Parent:FindFirstChild("Humanoid") then
						Humanoid.Health = 0
					end
				end)
			end

			bodyforce:Destroy()
		end
	end
	part.Touched:Connect(function(Hit)
		if not cooldown then
			cooldown = true
			print("HumanoidTouched")
			HitPart(Hit, plr.Name)
			any = true
		end
	end)
	part.CanCollide = false
	part.Size = part.Size +Vector3.new(3,3,3)
	part.Anchored = true
	part.Parent = workspace
	for i = 1, 100 do
		wait()
		part.CFrame = plr.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-3)
		if any then
			part:Destroy()
			break
		end
	end
	part:Destroy()
end)				

i hope this helps