I’m making a simple thing where ‘bullets’ constantly spawns from an attachment from player’s head
But for some reason the CFrame of the ‘bullets’ doesn’t update even though I checked in playtest viewing workspace and the attachment WorldCFrame does update
I also tried various method like .Orientation and .Position
I used this head tracking cursor code from This post
This is the basic code inside a script to spawn the ‘bullets’
while wait(1) do
local Unit = game.ReplicatedStorage.Bullet:Clone()
Unit.Parent = game.Workspace
Unit.CFrame = script.Parent:FindFirstChild("Head").HeadFront.WorldCFrame
end
-- HeadFront.WorldCFrame is the visible attachment seen
Anything helps, although I might not respond within days sorry
If the script is in the “bullet” and you’re using its LookVector, it’s always going to go the same way (assuming the script is in the billet which it probably is because you’re setting its parent’s velocity)
The CFrame of the attachment is base from the Parent so when using on other things like a part then the CFrame is changed to be from the center of workspace
The WorldCFrame is the CFrame of the attachment from the center of workspace so that’s why I use it
local Mouse = game.Players.LocalPlayer:GetMouse()
local Head = Character.Head or Character:WaitForChild("Head")
local HeadPosition = Head.Position
local Attachment = Head:WaitForChild("LookAttachment")
local TweenService = game:GetService("TweenService")
local LookCFrame = CFrame.lookat(HeadPosition,Mouse.Hit.Position)
TweenService:Create(Head,TweenInfo.new(.05),{CFrame = LookCFrame}):Play()