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

What is wrong with this camera script?

Asked by 10 years ago

It is supposed to shake the camera when the temperature is greater or equal to 2500. For some strange reason it isn't working. Any help? Thanks.

Just want to say, This script WILL work.

function shake()
    local camera = game.Workspace.CurrentCamera
    for i = 1,10 do 
        wait()
        camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0,2,0)
        wait()
        camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0,-2,0)
    end 
end 

while true do 
    wait(0.01)
    shake()
end 

This one does NOT work.

Temperature=game.Workspace.TemperatureValue
camera = game.Workspace.CurrentCamera

function shake()
    if Temperature.Value >=2500 then
    for i = 1,10 do 
        wait()
        camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0,2,0)
        wait()
        camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0,-2,0)
    end 
end 

while true do 
    wait(0.1)
    shake()
end 
end

Answer this question