Hello scripters! I’ve been using this Camera Script recently, however it has been bugging out. Causing it to freeze in place and not follow the Character. The view is top-down, here is my game:
I really don’t have a clue why it’s acting like this, perhaps the script itself is inefficient? could it be structured better?
Local Script in StarterCharacterScript:
wait()
require(script.Parent.StateHandler):Init()
Moduel Script in StarterCharacterScript:
-- // REQUIRES \\ --
local CameraHandler = require(script.CameraHandler)
local FaceMouse = require(script.FaceMouse)
-- // CONSTANTS \\ --
local plr = game.Players.LocalPlayer
local StarterGui = game:GetService("StarterGui")
-- // EXECUTABLES \\ --
local SH = {}
local function RegenerateProperites(char)
local Torso = char:WaitForChild("UpperTorso")
local hum = char:WaitForChild("Humanoid")
hum.BreakJointsOnDeath = false
CameraHandler:Follow(Torso)
FaceMouse:RotateToMouse(char)
end
function SH:Init()
self.Init = nil
-- PRESET INCASE CHARACTER ALREADY EXISTS
if plr.Character then
RegenerateProperites(plr.Character)
end
-- SETUP CHARACTER ON RESPAWNS
plr.CharacterAdded:Connect(RegenerateProperites)
end
return SH