Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make my character follow my mouse?

Asked by
neoG457 315 Moderation Voter
8 years ago
local speed    = 10   
        local Woosh    = Instance.new("BodyVelocity")
        Woosh.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        Woosh.velocity = CFrame.new(Player.Character.Torso.CFrame, Mouse.Hit).lookVector * speed
        Woosh.Parent   = Player.Character.Torso 

So basically I want my character to slowly make its way to wherever my mouse is pointing kinda like Agar.io but without the circles.

1 answer

Log in to vote
2
Answered by 8 years ago

Problem

You want your player to follow your mouse but you are using a Body value, this is extremely ineffcient as you can just use WalkToPoint

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local mouse = player:GetMouse()

while true do
wait()
if mouse.Hit then
player.Character.Humanoid.WalkToPoint = mouse.Hit.p
end
end
0
Okay how do I stop it from happening after a certain amount of time neoG457 315 — 8y
Ad

Answer this question