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.

01player = game.Players.LocalPlayer
02mouse = player:GetMouse()
03 
04mouse.KeyDown:Connect(function(key)
05    if key == "g" and player.Name == "bearpro2" then
06        local target = mouse.hit
07        projectile = game.ReplicatedStorage.ownerProjectile:Clone()
08        projectile.CFrame = player.Character.Torso.CFrame
09        projectile.Parent = game.Workspace
10        for i=0,1,0.001 do
11            wait()
12            projectile.CFrame = projectile.CFrame:lerp(target.CFrame,0.5)
13        end
14    end
15end)
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?