I am currently trying to learn CFrame and attempting to point a part towards a player (their humanoidrootpart), but after testing some things to try and ignore the Y axis (for rotation / orientation) and reverting it, the parts being moved by CFrame are just flying across the map in milliseconds.
The script:
local char
--cframe
local t = script.Parent.mainpart
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:wait()
char = player.Character
end)
game:GetService("RunService").Heartbeat:Connect(function()
if char ~= nil then
t.CFrame = CFrame.new(t.Position + char.HumanoidRootPart.Position)
end
end)
I feel like it might not be a problem with the script, if this is confirmed I can tell the layout of the parts being moved by CFrame (theyre welded)
So I’m a bit confused about what exactly your trying to do. But I guess you could
local char
--cframe
local t = script.Parent.mainpart
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:wait()
char = player.Character
end)
local x = t.Cframe.X
game:GetService("RunService").Heartbeat:Connect(function()
if char ~= nil then
t.CFrame = CFrame.new(t.Position,char.HumanoidRootPart.Position)
t.Cframe.X = x
end
The cframe is really only facing toward the root it won’t move anywhere unless you change the first of the cframe.new values