Ok, so, I have a click-plane, similar to that of Naval Warfare. Now, the problem is, how the plane works is I have a bodyposition created everytime the player equips the fly tool, and it flies to where the player clicks. I use mouse.Hit.p, and that'll show where they clicked. I parent the plane model into the character so it ignores the plane. Anyway, if I click the baseplate, the plane flies to a halt and kinda just sits there... pls help Local Script
local tool = script.Parent
tool.Equipped:Connect(function(mouse)
local plr = game.Players.LocalPlayer
local char = plr.Character
local cam = workspace.CurrentCamera
workspace.Gravity = 0
mouse.Button1Down:Connect(function()
if not char then return end
mouse.TargetFilter = char.Humanoid.SeatPart.Parent.Body
tool.ChangeVelocity:FireServer(cam:ScreenPointToRay(mouse.X, mouse.Y, 0))
end)
tool.Unequipped:Connect(function()
tool.DestroyVelocity:FireServer()
workspace.Gravity = 196.2
end)
end)
Server Script
local tool = script.Parent
tool.ChangeVelocity.OnServerEvent:Connect(function(plr, mouseP)
if plr.Character then
local torso = plr.Character.Torso
if torso:FindFirstChild("BodyPosition") then
torso.BodyPosition.Position = mouseP
torso.BodyGyro.CFrame = CFrame.new(torso.Position, mouseP)
else
local bodyPosition = Instance.new("BodyPosition")
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.CFrame = CFrame.Angles(mouseP.X, mouseP.Y, mouseP.Z)
bodyPosition.MaxForce = Vector3.new(350,350,350)
bodyPosition.P = 40
bodyPosition.Position = mouseP
bodyPosition.Parent = torso
bodyGyro.Parent = torso
end
end
end)
tool.DestroyVelocity.OnServerEvent:Connect(function(plr)
if plr.Character then
plr.Character.Torso.BodyPosition:Destroy()
plr.Character.Torso.BodyGyro:Destroy()
end
end)
(also the body gyro doesn't work well, it makes the plane spin. if you know how to fix that pls tell me)
