Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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
0
Why is the LS in workspace lol T0XN 276 — 5y
0
Where shall I place it? SwingingMelons -18 — 5y
0
Startergui, StarterPlayer, Starter-Anywhere. superender11 -17 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
Ad

Answer this question