the script is for camera being in a part’s position but won’t work:
plr = game.Players.PlayerAdded:Wait()
char = plr.CharacterAdded:Wait()
hum = char:FindFirstChild("Humanoid")
cam = workspace.CurrentCamera
Ppos = script.Parent
cam.CameraType = Enum.CameraType.Scriptable
char:MoveTo(script.Parent.Position)
hum.WalkSpeed = 0
hum.JumpPower = 0
cam.CFrame = CFrame.new(Ppos.Position)
2 Likes
Firstly, you’re trying to set the camera and character to the same position (was this by design)?
Secondly camera’s need to be updated. Usually scripters will use RunService to update the camera.
2 Likes
i dont know how to use runservice mind giving me a script please and no not by design im trynna make character customization yk like those games
local RunService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local function updateCamera()
--write what you want the camera to do here
end
RunService.RenderStepped:Connect(updateCamera)
Something like this?
nope doesn’t work at all i dont think functions will do anything attempt to index nil with “Character”
If you want to manipulate the camera, it needs to be done on the client side (from the player itself), as you can’t manipulate the player’s CurrentCamera from the server!
This can be done with a LocalScript from either the StarterPlayer/CharacterScripts or the StarterGui, but my example can be done just in StarterPlayerScripts (if you do choose to make a customization gui, however, you may do so under a ScreenGui under StarterGui).
When declaring variables, use “local” and use recommended practices when getting player and character:
local playersService = game:GetService("Players")
local player = playersService.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local part = workspace.Part -- edit according to part you would like to use
local currentCamera = workspace.CurrentCamera
currentCamera.CameraType = Enum.CameraType.Scriptable
currentCamera.CFrame = part.CFrame -- much more clean!
I don’t believe you have to use RunService, unless the part position is constantly changing.
If you want to learn more about camera manipulation, these videos are good:
Advanced Roblox Scripting Tutorial #28 - Camera Manipulation (Beginner to Pro 2020) - YouTube
Roblox Cutscene Script Tutorial (youtube.com)
(might be a little outdated, also check out: Controlling the User’s Camera | Documentation - Roblox Creator Hub)
i just watched the video of thedevking before u sent me but lemme try the script
1 Like
attempt to index nil with character
and the cam should be on a part and u deleted a line of the code
Did you put it in a LocalScript under StarterPlayerScripts?
Also, I made a mistake in the original code - recopy it and try again
1 Like
He had character there so I assumed.