How can I make a script that makes a model cframe the same as the player’s head cframe so the model moves with the head when the player moves the model. So basically the model always follows the players head cframe
How can I make a script that makes a model cframe the same as the players head cframe
Weld the model to the head.
How would I get about doing that?
CFrame the model to the head position then create a new WeldConstraint object inside the model and assign the Weld’s properties Part0 to the head and Part1 to the model.
local storage = game:GetService("ReplicatedStorage") local part = storage:WaitForChild("Part") local players = game:GetService("Players") players.PlayerAdded:Connect(function(player) player.CharacterAppearanceLoaded:Connect(function(character) local head = character:WaitForChild("Head") local clone = part:Clone() clone.Parent = workspace clone.CFrame = head.CFrame local weld = Instance.new("WeldConstraint") weld.Parent = workspace weld.Part0 = clone weld.Part1 = head end) end)
Here’s a simple bit of code which will weld a part to the head of the player’s character.