Fearen helped me earlier make my turret I move so I edited the script a little then it moves in every direction which was perfect, but there was 1 side effect.. It moved like a car even though I didn't even move my "WASD" key and still the turret follow my mouse and moved to it.
This is the script;
wait(0.2)
local TARGET_RADIUS = 5
local MAX_SPEED = 1750
local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
local MAX_THRUST = 1750
local THRUST_P = 500
local THRUST_D = 500
md = false
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.TargetFilter = script.Value.Value
local running = false
local gun=script.Value.Value
local SPAWN = gun.body:GetPrimaryPartCFrame()
local aimpos = Vector3.new(0,0,0)
rs=game:GetService("RunService").RenderStepped
local canfire = true
local round = 1
function fire()
if canfire == true and md == true then
canfire=false
local spawnPosition
if round ==1 then
spawnPosition = gun.gun.Gun.Position + (gun.gun.Gun.CFrame.lookVector * 5)
else
spawnPosition = gun.gun.Gun2.Position + (gun.gun.Gun2.CFrame.lookVector * 5)
end
if round == 1 then
game:GetService("Debris"):AddItem(a,7)
else
game:GetService("Debris"):AddItem(a,7)
end
if round ==1 then
round = 2
else
round = 1
end
wait(0.1)
canfire=true
if md == true then
fire()
end
end
function poo()
mouse.TargetFilter = nil
mouse.Icon=oldIcon
script:remove()
end
function no()
md = false
end
function mousedown()
md = true
fire()
end
oldIcon = mouse.Icon
person = game.Players.LocalPlayer.Character
person.Humanoid.Jumping:connect(poo)
mouse.Button1Down:connect(mousedown) -- Run function
mouse.Button1Up:connect(no)
while rs:Wait() do
aimpos = mouse.Hit.p
if (aimpos-gun.base.Position).magnitude>3 then
local c = aimpos
local x = (gun.gun:GetPrimaryPartCFrame()*CFrame.new(0, 0, -100000)).x
local y = (SPAWN*CFrame.new(0, 0, -100000)).y
local z = (gun.gun:GetPrimaryPartCFrame()*CFrame.new(0, 0, -100000)).z
A = Vector3.new(x,
y,
z
)
if c then
gun.gun:SetPrimaryPartCFrame(
CFrame.new(gun.body:GetPrimaryPartCFrame().p,
c)
)
gun.body:SetPrimaryPartCFrame(
CFrame.new(
SPAWN.p,
A
)
)
else
gun:SetPrimaryPartCFrame(gun.body:GetPrimaryPartCFrame())
gun.body:SetPrimaryPartCFrame(
CFrame.new(
SPAWN.p,
A
)
)
end
end
end

7 comments
You're setting the cframe (position and orientation), try setting the rotation/orientation instead?
ok
ok
that just made it not move
whenever i the orientation most of the script is getPrimaryPartCFrame
sadly you cant to :GetPrimaryPartOrientation
anyone :(