I’m making an scp-gengre game and stumbled on issue with DistanceFromCharacter function returning 0 instead of real numbers. But magnitude method is working fine
No, it’s not broken. It returns 0 if player’s character is not there. And it get’s distance from the character’s head, hence the slight difference compared to primary part magnitude.
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
print(player:DistanceFromCharacter(Vector3.new(50,0,50)))
I also suggest you initially check whether character and its primary part exist before attempting to index position of a killer and a target.
Lol, I wasn’t completely sure why it didn’t work in your case (suspecting some tricky parameter issue or so), but definitely wasn’t expecting missing heads!