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
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