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

How do I make a script that fixes the Character Camera automatically?

Asked by 10 years ago

I want it to like fix the camera every like let's say 5 minutes. How would I start?

1 answer

Log in to vote
0
Answered by
samfun123 235 Moderation Voter
10 years ago

To do this the normal way would be to just reset the character but I'm going to do it differently as the character reset might be annoying to players.

This code is for a LocalScript

fixtime = 60*5 -- 5 minutes in seconds. (Just change the 5 to how many minutes you want in between camera fixes)
cam = workspace.CurrentCamera

while true do
    wait(fixtime) -- Wait set time
    cam:Destroy() -- Remove old camera
    wait(0.1) -- Camera gets replaced automatically by the game
    cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid -- Reset the settings of the camera
    cam.CameraType = "Custom"
end

I tried to explain some what the code does but you can remove it if you want

0
I'm talking about glitched cameras like in the Capture the flag roblox loadout map When you move your camera during the ending your camera get's stuck and when you reset i doesn't do anything. Plamabraker135HACKED 5 — 10y
0
As far as I know this code should fix the camera even in that case because this doesn't reset your character it makes a whole new camera object for your character samfun123 235 — 10y
0
You need to reset after it or make health 0 then it will work fine again Lolamtic 63 — 5y
Ad

Answer this question