Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-2024-08-06· OpenAIAi2 WildChat-4.8M (AI2)

You will be given a Luau script (that has been decompiled). You will rename the…

  1. User

    System: You will be given a Luau script (that has been decompiled). You will rename the variables and functions to sound better, make the script more coherent, and add comments to areas of the script. Return the fixed script without adding ``` as we handle that. If no script has been given, do not produce any output. Do not respond with anything but the script User: -- Decompiled with Konstant V2.1, a fast Luau decompiler made in Luau by plusgiant5 (https://discord.gg/wyButjTMhM) -- Decompiled on 2024-11-11 15:00:03 -- Luau version 6, Types version 3 -- Time taken: 0.004705 seconds

    -- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments repeat wait() until game.Workspace.CurrentCamera ~= nil wait() c = game.Workspace.CurrentCamera -- Setting global function tweenCam(arg1, arg2, arg3, arg4, arg5, arg6) -- Line 6 local var20 local var21 if arg6 == 1 then var20 = 1 var21 = 181 else var20 = -90 var21 = 90 end for i = var20, var21, arg3 do c.CameraType = "Scriptable" local var22 if arg6 == 1 then var22 = 0.0055248618784530384 * i elseif arg6 == 2 then var22 = (math.sin(math.rad(i)) + 1) / 2 end c.CoordinateFrame = CFrame.new(c.CoordinateFrame.p:lerp(arg1.p, var22)) c.Focus = CFrame.new(c.Focus.p:lerp(arg2.p, var22)) c.FieldOfView = Vector3.new(c.FieldOfView, 0, 0):Lerp(Vector3.new(arg4, 0, 0), var22).X c:SetRoll(Vector3.new(c:GetRoll(), 0, 0):Lerp(Vector3.new(arg5, 0, 0), var22).X) c.CoordinateFrame = CFrame.new(c.CoordinateFrame.p, c.Focus.p) wait() end end print("Running") c.CameraSubject = nil c.CameraType = "Scriptable" local clone_3 = script.CaptionsGUI:clone() clone_3.Parent = game.Players.LocalPlayer.PlayerGui c.CoordinateFrame = script.CutsceneData['1'].c1.Value c.Focus = script.CutsceneData['1'].f1.Value c.FieldOfView = script.CutsceneData['1'].FOV.Value c:SetRoll(script.CutsceneData['1'].Roll.Value) if script:findFirstChild("SkipCutscene") then local clone_2 = script.SkipCutsceneGui:clone() clone_2.Parent = game.Players.LocalPlayer.PlayerGui clone_2.Cutscene.Value = script clone_2.Caption.Value = clone_3 clone_2.Main.Debug.Disabled = false script.SkipCutscene.Value = clone_2 end for i_2 = 2, #script.CutsceneData:GetChildren() do local var25 = script.CutsceneData[tostring(i_2)] clone_3.Caption.Text = var25.Caption.Value tweenCam(var25.c1.Value, var25.f1.Value, var25.step.Value, var25.FOV.Value, var25.Roll.Value, var25.Style.Value) local var26 end c.CameraSubject = game.Players.LocalPlayer.Character.Humanoid c.CameraType = "Custom" c.FieldOfView = 70 var26:Destroy() if script:findFirstChild("SkipCutscene") then if script.SkipCutscene.Value ~= nil then script.SkipCutscene.Value:Destroy() end end script:Destroy() Assistant:

  2. Assistant
    -- Initialize the camera
    repeat
    	wait()
    until game.Workspace.CurrentCamera ~= nil
    wait()
    local camera = game.Workspace.CurrentCamera -- Assign the current camera to a local variable
    
    -- Function to animate the camera transition
    function animateCameraPosition(targetPosition, targetFocus, step, targetFOV, targetRoll, transitionStyle)
    	local startAngle, endAngle
    	if transitionStyle == 1 then
    		startAngle = 1
    		endAngle = 181
    	else
    		startAngle = -90
    		endAngle = 90
    	end
    
    	for i = startAngle, endAngle, step do
    		camera.CameraType = "Scriptable"
    		local interpolationFactor
    		if transitionStyle == 1 then
    			interpolationFactor = 0.0055248618784530384 * i
    		elseif transitionStyle == 2 then
    			interpolationFactor = (math.sin(math.rad(i)) + 1) / 2
    		end
    
    		camera.CoordinateFrame = CFrame.new(camera.CoordinateFrame.p:lerp(targetPosition.p, interpolationFactor))
    		camera.Focus = CFrame.new(camera.Focus.p:lerp(targetFocus.p, interpolationFactor))
    		camera.FieldOfView = Vector3.new(camera.FieldOfView, 0, 0):Lerp(Vector3.new(targetFOV, 0, 0), interpolationFactor).X
    		camera:SetRoll(Vector3.new(camera:GetRoll(), 0, 0):Lerp(Vector3.new(targetRoll, 0, 0), interpolationFactor).X)
    		camera.CoordinateFrame = CFrame.new(camera.CoordinateFrame.p, camera.Focus.p)
    		wait()
    	end
    end
    
    print("Running")
    camera.CameraSubject = nil
    camera.CameraType = "Scriptable"
    
    -- Clone the Captions GUI and add it to the player's GUI
    local captionsGUIClone = script.CaptionsGUI:Clone()
    captionsGUIClone.Parent = game.Players.LocalPlayer.PlayerGui
    
    -- Initialize camera settings based on CutsceneData
    camera.CoordinateFrame = script.CutsceneData['1'].c1.Value
    camera.Focus = script.CutsceneData['1'].f1.Value
    camera.FieldOfView = script.CutsceneData['1'].FOV.Value
    camera:SetRoll(script.CutsceneData['1'].Roll.Value)
    
    -- Handling the Skip Cutscene option
    if script:FindFirstChild("SkipCutscene") then
    	local skipCutsceneGUIClone = script.SkipCutsceneGui:Clone()
    	skipCutsceneGUIClone.Parent = game.Players.LocalPlayer.PlayerGui
    	skipCutsceneGUIClone.Cutscene.Value = script
    	skipCutsceneGUIClone.Caption.Value = captionsGUIClone
    	skipCutsceneGUIClone.Main.Debug.Disabled = false
    	script.SkipCutscene.Value = skipCutsceneGUIClone
    end
    
    -- Iterate over each cutscene data entry to perform camera animating and caption updating
    for sceneIndex = 2, #script.CutsceneData:GetChildren() do
    	local sceneData = script.CutsceneData[tostring(sceneIndex)]
    	captionsGUIClone.Caption.Text = sceneData.Caption.Value
    	animateCameraPosition(sceneData.c1.Value, sceneData.f1.Value, sceneData.step.Value, sceneData.FOV.Value, sceneData.Roll.Value, sceneData.Style.Value)
    end
    
    -- Reset camera settings back to the player's character
    camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    camera.CameraType = "Custom"
    camera.FieldOfView = 70
    
    -- Clean up skip cutscene if exists
    if script:FindFirstChild("SkipCutscene") then
    	if script.SkipCutscene.Value ~= nil then
    		script.SkipCutscene.Value:Destroy()
    	end
    end
    
    -- Destroy the script
    script:Destroy()