Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't this projectile following the mouse?

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

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

6 comments

0

I did that but it still not following mouse?

0

I did that but it still not following mouse?

0

I am going to edit it. Just copy what I do.

0

o9k

0

I figured it out but thx for help

0

I forgot to edit it. Lol, sorry!

This discussion is preserved as it was. New answers, comments, and votes are closed.