So I was testing with some “Tools” and I came to a problem when I came up to this tool on where the Move trigger only moves slightly and then stops. Here’s the video.
Here’s the script.
local tool = script.Parent
local mod = require(game.ReplicatedStorage.KeyframeAnimationPlayer)
local keyframe = tool.Animation
local player = script:FindFirstAncestorWhichIsA"Player" or game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent)
local ts = game:GetService("TweenService")
local ogspeed = player.Character.Humanoid.WalkSpeed
local input = game.ReplicatedStorage.Events.DisableInputs
local anim = mod:LoadAnimation(player.Character.HumanoidRootPart, keyframe)
local d = false
tool.Activated:Connect(function()
d = true
local sound = tool.Handle.Sound:Clone()
local rootpivot = player.Character.HumanoidRootPart:GetPivot()
sound.Parent = player.Character.HumanoidRootPart
--sound:Play()
player:Move(rootpivot * Vector3.new(0,0,-1), false)
input:FireClient(player, true)
player.Character.Humanoid.WalkSpeed = ogspeed + 50
local HRP = player.Character.HumanoidRootPart
local Lenght = 15
local Ray1 = Ray.new(HRP.Position, HRP.CFrame.LookVector*Lenght)
local Wall, HitPosition, Normal, Material = workspace:FindPartOnRay(Ray1, player.Character)
if Wall then
input:FireClient(player, false)
player:Move(Vector3.new(0,0,0), false)
player.Character.Humanoid.WalkSpeed = ogspeed
end
end)
It was my friend’s game so that’s why I used a keyframe module (he gave me permission)
it will stop automatically after 8 seconds or if the player moves his character. you can also use a .Touched event to see if it hits certain parts and then cancel the :MoveTo()
even with MoveTo(), the player will stop moving if it hits a wall because the player can’t go through the wall. why do you want to cancel the MoveTo()?
but what’s the point of cancelling the MoveTo() if the character can’t go through the wall anyway? if the player can’t move, MoveTo() doesn’t do anything
So basically, the player will move fast and then if it runs into a player, the player will get damaged. Here’s the current tool for now. And I moved it into my game.
New script:
local tool = script.Parent
local player = script:FindFirstAncestorWhichIsA"Player" or game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent)
local ts = game:GetService("TweenService")
local ogspeed = player.Character.Humanoid.WalkSpeed
local input = game.ReplicatedStorage.Events.DisableInputs
local hitsound, line = tool.Handle.Hit:Clone(), tool.Handle["i love knocking out teeth"]:Clone()
local running = false
local anim = script["i love to grab!"]
local humanoid = player.Character.Humanoid
tool.Activated:Connect(function(h:Humanoid)
local animloaded = humanoid:LoadAnimation(anim)
local sound = tool.Handle.Sound:Clone()
local rootpivot = player.Character.HumanoidRootPart:GetPivot()
sound.Parent = player.Character.HumanoidRootPart
sound:Play()
animloaded:Play()
player.Character.Humanoid:MoveTo(rootpivot * Vector3.new(0,0,-100), nil)
input:FireClient(player, true)
player.Character.Humanoid.WalkSpeed = ogspeed + 50
local HRP = player.Character.HumanoidRootPart
local Lenght = 15
local Ray1 = Ray.new(HRP.Position, HRP.CFrame.LookVector*Lenght)
local Wall, HitPosition, Normal, Material = workspace:FindPartOnRay(Ray1, player.Character)
task.wait(0.2)
running = true
player.Character.Humanoid.Running:Connect(function(speed)
if speed < 0.1 then
if running == true then
print("ruh roh!!! roadblock!")
animloaded:Stop()
running = false
input:FireClient(player, false)
player.Character.Humanoid:Move(Vector3.new(0,0,0))
player.Character.Humanoid.WalkSpeed = ogspeed
sound:Destroy()
end
end
end)
player.Character.Torso.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if running == true then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local HRP2 = hit.Parent:FindFirstChild("Torso")
input:FireClient(player, false)
animloaded:Stop()
player.Character.Humanoid:Move(Vector3.new(0,0,0))
player.Character.Humanoid.WalkSpeed = ogspeed
hitsound.Parent = HRP2
hitsound:Play()
line.Parent = HRP
line:Play()
humanoid:TakeDamage(32)
running = false
end
end
end)
end)