What I’m trying to do is rotate the camera around the player at certain times and I managed to find this script (Customizing the Camera | Documentation - Roblox Creator Hub) but I do not know where the Humanoid is located in the explorer
Under the Character. The camera is automatically set to follow the character’s humanoid.
So you won’t find the Humanoid inside the Explorer while not playing.
local player = game.Players.LocalPlayer
local Humanoid = player.Character.Humanoid -- Humanoid
While Playing the Game You "Humanoid"
Will be Added into The Players Character.
The Players Character Will Be in
Game.Workspace
It didn’t work. The camera didn’t spin on the humanoid.
What Camera Script are You Using?
Hang On Let me Check what the problem is.
local target = Workspace.Ticaweend:FindFirstChild(“HumanoidRootPart”) if I use this works but it won’t work with more players
Well it obviously will not work if you only make it work for yourself. When you do:
workspace.Ticaweend
you assume that everyone in the game is named that. You can use get the character of the local player and search for their humanoidrootpart
from there so it works for everyone…
Yea @synical4 Is Right.
The Character Name in Workspace is the Specific Players Name. Your Name is “Ticaweend”
So You Put
game.Workspace.Ticaweend
You can access the humanoid within the player instance.
Example 1 (LocalScript):
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild('Humanoid')
Example 2 (ServerScript):
local Players = game:GetService('Players')
local function PlayerAdded(Player)
local function CharacterAdded(Character)
local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart')
-- Do whatever you'd like here. This code will run everytime their character is added to workspace.
-- If you only want to access it once, remove the CharacterAdded function, and everything including Character.
end
local Character = Player.Character
if Character then
coroutine.resume(coroutine.create(function()
CharacterAdded(Character)
-- Runs the function for each character that already exist before the .CharacterAdded event is ran, in parallel.
end))
end
Player.CharacterAdded:Connect(CharacterAdded)
end
local GetPlayers = Players:GetPlayers()
for i = 1, #GetPlayers do
local Player = GetPlayers[i]
coroutine.resume(coroutine.create(function()
PlayerAdded(Player)
-- Runs the function for each player that already exist before the .PlayerAdded event is ran, in parallel.
end))
end
However, for camera manipulations - you should use a LocalScript.
I’m doing something wrong. I put the script in StarterCharacterScript and so I modified the script
If I put to target Part works
local TweenService = game:GetService(“TweenService”)
local RunService = game:GetService(“RunService”)
local Players = game:GetService(‘Players’)
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild(‘Humanoid’)
local target = game:FindFirstChild("Humanoid") -- The object to rotate around
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local rotationAngle = Instance.new("NumberValue")
local tweenComplete = false
local cameraOffset = Vector3.new(0, 10, 12)
local rotationTime = 15 -- Time in seconds
local rotationDegrees = 360
local rotationRepeatCount = -1 -- Use -1 for infinite repeats
local lookAtTarget = true -- Whether the camera tilts to point directly at the target
local function updateCamera()
if not target then return end
camera.Focus = target.CFrame
local rotatedCFrame = CFrame.Angles(0, math.rad(rotationAngle.Value), 0)
rotatedCFrame = CFrame.new(target.Position) * rotatedCFrame
camera.CFrame = rotatedCFrame:ToWorldSpace(CFrame.new(cameraOffset))
if lookAtTarget == true then
camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
end
end
-- Set up and start rotation tween
local tweenInfo = TweenInfo.new(rotationTime, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, rotationRepeatCount)
local tween = TweenService:Create(rotationAngle, tweenInfo, {Value=rotationDegrees})
tween.Completed:Connect(function()
tweenComplete = true
end)
tween:Play()
-- Update camera position while tween runs
RunService.RenderStepped:Connect(function()
if tweenComplete == false then
updateCamera()
end
end)