Hello world, im using ChatGPT to modify the folowing script, but it, its a little bit.. yeah..
in the rror says: attempt to index nil with 'Character' -line 5
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera
-- Wait for character to be initialized
while not character do
character = player.Character or player.CharacterAdded:Wait()
wait()
end
-- Create black screen overlay
local gui = Instance.new("ScreenGui")
gui.IgnoreGuiInset = true
gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
gui.Parent = player.PlayerGui
local overlay = Instance.new("Frame")
overlay.Size = UDim2.new(1, 0, 1, 0)
overlay.Position = UDim2.new(0, 0, 0, 0)
overlay.BackgroundColor3 = Color3.new(0, 0, 0)
overlay.BackgroundTransparency = 1
overlay.Parent = gui
-- Function to fade screen in/out
local function fadeScreen(duration, fadeIn)
local startTime = tick()
local endTime = startTime + duration
while tick() < endTime do
local timeFraction = (tick() - startTime) / duration
overlay.BackgroundTransparency = fadeIn and (1 - timeFraction) or timeFraction
wait()
end
overlay.BackgroundTransparency = fadeIn and 0 or 1
end

1 comment
BTW, ChatGPT is amazing!