so i was trying to make a parkour system whereby the player smoothly moves to the part that the players mouse is hovering over, problem is I don’t know how to smooth move the player to the part, I was able to make a system that determines what part the player is hovering over.
local uis = game:GetService("UserInputService")
local runservice = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local TreeToJumpToo = player.TreeToJumpToo
local cantreejump = true
local anim = game:GetService("ReplicatedFirst").Animation
local animtrack = player.Character.Humanoid:LoadAnimation(anim)
local chr = player.Character
uis.InputBegan:Connect(function(input, e)
if e then return end
if input.KeyCode == Enum.KeyCode.LeftControl and cantreejump == true then
animtrack:Play()
animtrack:GetMarkerReachedSignal("TreeJumpEvent"):connect(function()
animtrack:AdjustSpeed(0)
end)
for i,v in game.Workspace.TreeLogs:GetChildren() do
runservice.Heartbeat:Connect(function()
if mouse.Target == v and cantreejump == true then
print("can tree jump")
TreeToJumpToo.Value = v.Name
end
end)
end
end
end)
uis.InputEnded:Connect(function(input, e)
if e then return end
if input.KeyCode == Enum.KeyCode.LeftControl then
cantreejump = false
animtrack:Stop()
if TreeToJumpToo.Value ~= "Nil" then
local treepart = game.Workspace.TreeLogs:FindFirstChild(TreeToJumpToo.Value)
player.Character.Humanoid:MoveTo(treepart.Position)
end
wait(2)
TreeToJumpToo.Value = "Nil"
cantreejump = true
end
end)