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

How do I make something follow my mouse after spawning by my character? [closed]

Asked by 6 years ago
Edited 6 years ago

I want to make a projectile that goes where my mouse is pointing, but I when I try a lerp, the part doesn't move.

Here's what I tried.

player = game.Players.LocalPlayer
mouse = player:GetMouse()

mouse.KeyDown:Connect(function(key)
    if key == "g" and player.Name == "bearpro2" then
        local target = mouse.hit
        projectile = game.ReplicatedStorage.ownerProjectile:Clone()
        projectile.CFrame = player.Character.Torso.CFrame
        projectile.Parent = game.Workspace
        for i=0,1,0.001 do
            wait()
            projectile.CFrame = projectile.CFrame:lerp(target.CFrame,0.5)
        end
    end
end)
0
Nope, you didn't even try. Attempt before asking this isn't a request site, we help those who have tried. BlackOrange3343 2676 — 6y
0
^ RealHexYT 12 — 6y
0
Having said that, if you need a push in the right direction, look into how BodyVelocity works. mattscy 3725 — 6y
0
Probably BodyGyro might help as well. SuperAndresZ_YT 202 — 6y

Closed as Not Constructive by minikitkat

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?