Help making a model point at a player

I’m currently trying to write a script that makes a model point towards a player at all times
this is the script I’m using:

local function FollowPlayer()
	if selectedPlayer then
		local player = selectedPlayer
		local character = player.Character
		if character then
			local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
			if humanoidRootPart then
				local direction = (humanoidRootPart.Position - spotlight.PrimaryPart.Position).Unit
				spotlight.PrimaryPart.CFrame = CFrame.lookAt(spotlight.PrimaryPart.Position, humanoidRootPart.Position, humanoidRootPart.Position)
				
			end
		end
	end
end 

local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(FollowPlayer)

(SelectedPlayer is already defined in a separate part of the script, no need to worry about that)

model

This is what the model looks like, if any extra information is needed let me know
Thanks in advance!

Do you have a video of what’s happening?

Yep, here you go
its very weird


Sorry if the video is a bit short by the way, it took a few tries because 10MB is the max file size :sweat_smile:

Try putting a decal on it. Set it to front to see which side is the front. You might just have the sides mixed up.

1 Like

The script is working fine, it’s just that the front side of the spotlight is not what you think it is.

1 Like

Yeah that seems to be the case :sweat_smile: