Hello! So I am currently working on a fnaf game though there was one issue I had and I couldn’t find any ways to fix it. I was working on the lobby and I wanted a fake npc of the player to teleport inside the lobby. Facing the camera.
The script is a local script inside the screengui.
CFrames are used to define both the angle and position of a Part or Attachment.
What you currently have for a CFrame is not the correct way to set it.
What is the CFrame supposed to be? Positional? Rotational? Both?
Whatever it is, use the functions provided by CFrame:
local Position_Only = CFrame.new(1, 2, 3)
local Rotation_Only = CFrame.Angles(math.rad(20), math.rad(90), 0) -- Must be in radians
local Both = Position_Only * Rotation_Only
-- OR
local Both = CFrame.new(1, 2, 3) * CFrame.Angles(math.rad(20), math.rad(90), 0)
I think I got it try this (Make sure to put a blank r15 or r6 rig in replicated storage)
(Also make sure this is in starterCharacter scripts)
local Players = game.Players
local Player = Players.LocalPlayer
local PlayerCharacter = Player.Character
local PlayerAppearance = Players:GetHumanoidDescriptionFromUserId(Player.UserId)
--Put a blank r15 or r6 dummy in replicated storage and name it "Dummy"
local PlayerCharacterNPC = game.ReplicatedStorage.Dummy:Clone()
PlayerCharacterNPC.Parent = game.Workspace
PlayerCharacterNPC.Humanoid:ApplyDescription(PlayerAppearance)
local LookVector = PlayerCharacter.PrimaryPart.CFrame.LookVector
PlayerCharacterNPC:SetPrimaryPartCFrame(CFrame.new(-10.9, 4.1, -36.85))
PlayerCharacterNPC.PrimaryPart.CFrame = CFrame.lookAt(PlayerCharacterNPC.PrimaryPart.Position,PlayerCharacter.PrimaryPart.Position)