-- Ultimate 2-D Fighitng Camera script
-- Version 1.0
-- Created by SpyGuyTBM
local X = {}
local Y = {}
local cam = workspace.CurrentCamera
cam.CameraType = "Scriptable"
wait(5)
while true do
wait(0.1)
for _,plr in pairs(game.Players:GetPlayers()) do
table.insert(X, plr.Character.Torso.CFrame.X )
table.insert(Y, plr.Character.Torso.CFrame.Y)
end
table.sort(X)
table.sort(Y)
local Xlow = X[1]
local Xhigh = X[#X]
local Xcam = (Xlow + Xhigh)/2
local Ylow = Y[1]
local Yhigh = Y[#X]
local Ycam = (Ylow + Yhigh)/2
local Xleng = Xhigh - Xlow
local NewXleng = Xleng/2
local Zcam = 1.42814801*NewXleng
cam:Interpolate(CFrame.new(Xcam,Ycam,Zcam + 10) , CFrame.new(Xcam,Ycam,5), 0.1)
X = {}
Y = {}
end
ok, before i state my question, i would like to thank the scripting helpers community for being helpful in my journey in scripting. One month ago i was a complete noob, and now i feel proud at how far i have come.
Anyways, enough with the sentimental stuff.
So this script is meant to replicate super smash bro's camera that zooms out when fighters move away, and zooms in when they come closer together.
And it works for the most part, try it out! It's really cool.
But, I cant get the camera to stay AT LEAST 10 studs away
cam:Interpolate(CFrame.new(Xcam,Ycam,Zcam + 10) , CFrame.new(Xcam,Ycam,5), 0.1)
in this line of code "Zcam + 10" is not pushing the camera 10 studs back. Why is this?

1 comment
thanks!