I'm attempting to create a rotatable turret mounted on the back of a truck. The parts of the truck (including the gun) are welded to the base. If I set the lookvector of the gun to the mouse.hit, it moves the whole truck. However, when I set the lookvector of the C0 of the weld used for the gun, the gun doesn't move at all.
Does anyone have a way to move the turret in all three axes?
the current code looks something like this:
doesn't move the gun at all:
local pos = vector3.new(0,0,0)
local gun = game.Workspace.Gun
local weldc0 = gun.Weld.C0
while true do
weldc0 = CFrame.new(weldc0.CFrame.p,pos)
wait(0.1)
end
moves whole truck, including gun:
local pos = vector3.new(0,0,0)
local gun = game.Workspace.Gun
local weldc0 = gun.Weld.C0
while true do
gun.CFrame = CFrame.new(gun.CFrame.p,pos)
wait(0.1)
end
Am I doing this wrong or is there a better way?
