Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My camera part script ain't working and I don' t know why, help?

I want to make a camera part which will be the main camera from when you spawn, until when you change place. Take in mind that this script is into a local script, which is inserted into workspace, not into the part which the camera is.

repeat wait() until game:GetService("Players").LocalPlayer.Character ~= nil
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Torso = Character.Torso
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = workspace.CurrentCamera
local Part = script.Parent.CameraPart 
local NotMoving = true -- nothing to do with the camera, it just stuns the player while the camera is working

while NotMoving == true do
    wait()
    Humanoid.WalkSpeed = 0
    Humanoid.Changed:connect(function() Humanoid.Jump  = false end)
    Camera.CameraType = "Scriptable"
	Camera.CoordinateFrame = workspace.CameraPart.CFrame  -- nothing to do with the camera, it just stuns the player while the camera is working
end

3 comments

0

Why is the LS in workspace lol

0

Where shall I place it?

0

Startergui, StarterPlayer, Starter-Anywhere.

1 answer

Uhh, hey. Not sure if this is what you want, but try this.

repeat wait() until game:GetService("Players").LocalPlayer.Character ~= nil
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Torso = Character.Torso
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = game.Workspace.CurrentCamera
local Part = script.Parent.Parent.CameraPart
local NotMoving = true -- nothing to do with the camera, it just stuns the player while the camera is working

while NotMoving == true do
    wait()
    Humanoid.WalkSpeed = 0
    Humanoid.Changed:connect(function() Humanoid.Jump  = false end)
    Camera.CameraType = "Scriptable"
    Camera.CoordinateFrame = workspace.CameraPart.CFrame  -- nothing to do with the camera, it just stuns the player while the camera is working
end

This discussion is preserved as it was. New answers, comments, and votes are closed.