#Player direction not automatically snapping to part direction

1 messages · Page 1 of 1 (latest)

radiant gale
#

I've tried everything and its still not snapping: ```lua

local function characteradded(character: Model)
LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson

local newcamerapart = Instance.new("Part")
local camera = workspace.CurrentCamera
local camX, camY, camZ = camera.CFrame:ToOrientation()
newcamerapart.Name = "CameraPart"
newcamerapart.CanCollide = false
newcamerapart.CanQuery = false
newcamerapart.CanTouch = false
newcamerapart.Anchored = false
newcamerapart.Transparency = 1
newcamerapart.Size = Vector3.new(0.001, 0.001, 0.001)
newcamerapart.Parent = GetHead()
newcamerapart.Position = GetHead().Position
local newcamerapartweld = Instance.new("WeldConstraint")
newcamerapartweld.Part0 = newcamerapart
newcamerapartweld.Part1 = GetHead()
newcamerapartweld.Parent = newcamerapart
local hrp = GetRootPart()
local head = GetHead()
local camerapartattachment = Instance.new("Attachment")
camerapartattachment.Parent = newcamerapart
local rootattachment = hrp.RootAttachment
local hrpdiralignwithcamerapart = Instance.new("AlignOrientation")
hrpdiralignwithcamerapart.Attachment0 = rootattachment
hrpdiralignwithcamerapart.Attachment1 = camerapartattachment
hrpdiralignwithcamerapart.RigidityEnabled = true
hrpdiralignwithcamerapart.Parent = newcamerapart
local humanoid = character:WaitForChild("Humanoid") :: Humanoid
while true do
  task.wait()
  camX, camY, camZ = camera.CFrame:ToOrientation()
  newcamerapart.CFrame = CFrame.new(head.Position, Vector3.new(0, camY, 0))
  camera.CameraSubject = newcamerapart
end

end
characteradded(GetCharacter())```

#

and yes, i did try cframes. it did the same thing.

#

also btw dont question why i made the arms transparent

feral saddle
#

CameraType isn't scriptable

#

idk if all those other functions work

#

but you overcomplicated it anyways

radiant gale
radiant gale
feral saddle
radiant gale
#

also you are being super rude

feral saddle
#

I tried to tell you that the CameraType isn't scriptable and thats why your script isnt working and you told me your not tryna remake the camera script 😭

radiant gale
#

and check it out for yourself scriptable doesnt allow you to move the camera: workspace.Camera.CameraType = Enum.CameraType.Scriptable

radiant gale
feral saddle
#

bro evilcat

#

im trying to help you but your just denying things I say 😭

radiant gale
#

i told you that scriptable is gonna make the camera unable to be moved by the player mouse

#

and your not listening

feral saddle
#

yes but thats the whole point to script the camera yourself

radiant gale
#

bro im not that advanced

feral saddle
#

you can't modify these other CameraTypes

radiant gale
#

ok lemme test it then

#

oh i forgot i wanted to make the player (character) direction have the same direction of the camerapart

feral saddle
#

yeah thats easy

#

you can add that at the end

radiant gale
#

thats the reason i made this post

#

yknow what screw it ima figure it out on my own

feral saddle
#

Im trying to find a solution rn, so yea tell me wehn you got one before me

feral saddle
#

fuck ts

#
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

local part = workspace.rotationPart

RunService.RenderStepped:Connect(function()
    local yRot = part.CFrame - part.CFrame.Position
    local cameraOffset = Vector3.new(0, 4, 8)
    local rotatedOffset = yRot:VectorToWorldSpace(cameraOffset)
    camera.CFrame = CFrame.new(hrp.Position + rotatedOffset, hrp.Position)
end)

task.spawn(function()
    while task.wait(.01) do
        part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(1), 0)
    end
end)

@radiant gale

feral saddle
#

and? @radiant gale

radiant gale
feral saddle
radiant gale
#

it sorta works but thank you

dapper cloud
dapper cloud