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

Why isn't this projectile following the mouse?

Asked by 4 years ago

Hi, I have been trying non stop to find the answer to this question but nothing that I have tried has worked. I am trying to make a "guided missile" like projectile that will follow the mouse. But it does not work instead the projectile just floats to a random position.

I am using remote function for this script.

So here is the local script

        remoteFunction:InvokeServer()
        Shoot()
        wait(0.5)
        --mouse.TargetFilter(projectile)
        --mouse.TargetFilter(game.Workspace[player.Name.."projectile"])
        for i = 1,60,1 do
            bodyposition.Position = mouse.Hit.Position
            wait(1)
        end


And here is the server script


local bodyposition = Instance.new("BodyPosition") bodyposition.Parent = projectile bodyposition.MaxForce = Vector3.new(1000,1000,1000) bodyposition.P = 1000 bodyposition.D = 1000 return bodyposition, projectile end)

Thanks for your time :D

1 answer

Log in to vote
0
Answered by 4 years ago

Simple, all you have to do is make the InvokeServer() a variable. Long story short this would be the final code for the local script.

    local Variable = remoteFunction:InvokeServer()
    Shoot()
    wait(0.5)
    --mouse.TargetFilter(projectile)
    --mouse.TargetFilter(game.Workspace[player.Name.."projectile"])
    for i = 1,60,1 do
        bodyposition.Position = mouse.Hit.Position
        wait(1)
    end
0
I did that but it still not following mouse? turbomegapower12345 48 — 4y
0
I did that but it still not following mouse? turbomegapower12345 48 — 4y
0
I am going to edit it. Just copy what I do. ScriptedEli 101 — 4y
0
o9k turbomegapower12345 48 — 4y
View all comments (2 more)
0
I figured it out but thx for help turbomegapower12345 48 — 4y
0
I forgot to edit it. Lol, sorry! ScriptedEli 101 — 4y
Ad

Answer this question