Hey, I am making a SAM system. The aim of this is to make the top half of the SAM follow a part (acting as a missile). The issue is that I have no idea how to do this, I have experimented with :SetPrimaryPartCFrame but it didn’t work.
If anyone knows how, can you please explain it aswell because I am new to advanced CFrames.
Im not the most experienced with models but i suggest using something like this
local m1 = game.Workspace.Model1
local m2 = game.Workspace.Model2
m1:PivotTo(CFrame.new(m1.PPart.Position,m2.PPart.Position))
To explain what happens here when you call only 2 arguments which are a position it attempts to set the Orientation of a Part or a Model to look at a certain Instance in the world, The first argument is the Part that will be facing a certain part, and the second the Part it will be facing
Does this script do what you’re trying to achieve?
local RS = game:GetService("RunService")
local Missile = script.Parent -- You can change this to the missle
local PartToHit = -- Put the part you want to look at here
local Speed = 2 -- You can change the speed to whatever you want
RS.Heartbeat:Connect(function()
Missile.CFrame = CFrame.lookAt(Missile.Position, PartToHit.Position)
Missile.CFrame *= CFrame.new(0, 0, -Speed)
end)