Hello people,
Please help me, I am trying to create a Pipe Bomb (Tool), a bit similar to Left 4 Survival on Roblox, and when I throw it, players around the Pipe Bomb will be forced to walk towards it, using lookAt() and look at it, with their HumanoidRootPart CFrame looking at the Pipe Bomb, and if the Pipe Bomb explodes and players are trying to walk towards it, it will just cancel the force walk and the lookAt() and I find that very hard.
I think it might be using:
Magnitude, lookAt() and MoveTo()
I have looked at many posts yet it doesn’t answer my question, and I have also tried to code it but it is very hard.
Please somebody tell me how to achieve this, maybe some posts or basic coding, but I am NOT asking for a whole script.
Please and thank you.
Here is a failed attempt of me trying to do the same effect, basically when you touch the part, you will be “forced” to walk to the target, while your HumanoidRootPart looks at the target, but it just like “locks” my character in place.
local part = script.Parent
local target = game.Workspace.target
part.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local char = hit.Parent
local humrp = hit.Parent:FindFirstChild("HumanoidRootPart")
if (humanoid ~= nil) then
humanoid:MoveTo(target.Position)
local oldhumrp = humrp.CFrame
while true do
humrp.CFrame = CFrame.lookAt(humrp.Position, Vector3.new(target.Position.X, humrp.Position.Y, target.Position.Z))
task.wait()
end
humanoid.MoveToFinished:Connect(function()
print("We reached the target!")
humrp.CFrame = oldhumrp
end)
end
end)