How to move turret cannon up and down?

Well there is no need for it, have you checked if the Steer value is actually changing?

The problem is that he would need to rotate it by the small barrel before the actual gunpart and I am also facing that problem too in my games so I am not sure how I can help him.

it does change i, tested that earlier

i just need to rotate the barrel, i made it so the center point of the barrel is at the point where i want it to rotate

but how does the other rotate function work without .Value?

Steer is not a value it’s a property plus it is working the problem is at the throttle and is related to the positioning of the item.

@Happygamer1983 he thought that it’s a ObjectValue rather than a seat.

Since the Barrel is just a part you could try…
Barrel.CFrame *= CFrame.Angles(math.deg(10), 0,0)

2 Likes

what would i put into the new CFrame though?

Same thing, just to see if it does something.

Check the code above in my last comment I edited it.

it does work but not really
grafik

Okay well then do with pivot to I guess just change to Z in that case.

if i use your edited code the turret is just gone
i used this code

Gun.CFrame = Gun:GetPivot() * CFrame.Angles(0, 0, -math.rad(1))

Nevermind try it on the X axis.

this code dose rotate it up/down but it does it for the whole turret

How about something like this?

--inside heartbeat event
local turretSeat = Turret:FindFirstChild("TurretSeat")

if turretSeat then
	if turretSeat.Steer ~= 0 then
		Gun.CFrame = Gun:GetPivot() * CFrame.Angles(0, math.rad(turretSeat.Steer), 0)
	end
end

Doesnt work, breaks everything
grafik

I think the problem is the welds, if i remove them and anchnor the part it works fine, but i need the welds

Oh that explains the problem, we should offset the weld instead, try this.

local weld = nil --you're gonna have to get the weld
weld.C1 = CFrame.Angles(0, math.rad(turretSeat.Steer), 0)

they are WeldConstraint’s not welds, do i have to change them to welds?

ok so i got it working, another thing how could i add a limit to how far up/down it can go? (Just replaced the WeldConstraint in the barrel with a normal Weld)

if Turret.TurretSeat.Throttle == 1 then
			Gun.CFrame = Gun:GetPivot() * CFrame.Angles(0, 0, -math.rad(1))
		elseif Turret.TurretSeat.Throttle == -1 then
			Gun.CFrame = Gun:GetPivot() * CFrame.Angles(0, 0, math.rad(1))
		end