How do I rotate a model depending on where the player is facing?

You can write your topic however you want, but you need to answer these questions:

I want a model (in this case it is a magic beam) to face the direction I’m facing at

The issue is when I turn and spawned the model it doesn’t turn, it just faces only one way unless if I rotate the primary part. (It does spawn where I am at, just doesn’t turn to where I am facing)
FACING RIGHT WAY:


WHEN I TURN AND PRESS THE KEY:

Here is my code right now:

local beam = game.ServerStorage:WaitForChild("Model"):Clone()



game.ReplicatedStorage.beam.OnServerEvent:Connect(function(player)
	local char = player.Character
	char.HumanoidRootPart.Anchored = true
	local humanoid = player.Character.Humanoid
	local animation = script.Animation
	local load = humanoid:LoadAnimation(animation)
	
	load:Play()
	wait(2)
	

	
	

	char.HumanoidRootPart.Anchored = false
	beam.PrimaryPart = beam.primary
	local primary = beam.primary
	
	beam.Parent = game.Workspace
	beam:SetPrimaryPartCFrame(CFrame.new(player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector))
	wait(4)
	beam.Parent = game.ServerStorage
	
	
	
end)
1 Like
local beam = game.ServerStorage:WaitForChild("Model"):Clone()



game.ReplicatedStorage.beam.OnServerEvent:Connect(function(player)
	local char = player.Character
	char.HumanoidRootPart.Anchored = true
	local humanoid = player.Character.Humanoid
	local animation = script.Animation
	local load = humanoid:LoadAnimation(animation)
	
	load:Play()
	wait(2)
	

	
	

	char.HumanoidRootPart.Anchored = false
	beam.PrimaryPart = beam.primary
	local primary = beam.primary
	
	beam.Parent = game.Workspace
repeat
wait(0.2)
	beam:SetPrimaryPartCFrame(CFrame.new(player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector))
until beam.Parent ~= workspace
	wait(4)
	beam.Parent = game.ServerStorage
	
	
	
end)
beam:SetPrimaryPartCFrame(CFrame.new(player.Character.HumanoidRootPart.Position, player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector))

do you want the beam to follow the player after its have been activated, or when it activate it is rotated to where the player is looking?

I want it to rotate when it is activated like a way where the player doesn’t see it rotating

Ok thanks I’ll test it and see if it works

It worked! Wow I didn’t know it was such a simple mistake thank you.