H
Key RequiredUniversal

H

Universal Scriptxianivomxianivom 9.9K views 30 executesUpdated Jul 5, 2025
5.0/ 5(3 votes)
30100% Positive
Lua Script•236 lines (7694 chars)
--//Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local lighting = game:GetService("Lighting")
local soundService = game:GetService("SoundService")
local workspace = game:GetService("Workspace")

--//Variables
local plr = Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local camera = workspace.CurrentCamera

plr.CameraMode = Enum.CameraMode.LockFirstPerson
if character:FindFirstChildOfClass("Humanoid") then
    character.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
end

RunService.RenderStepped:Connect(function()
    for i,v in pairs(character:GetChildren()) do
        if (v:IsA("BasePart")) and v.Name ~= "Head" then
            v.LocalTransparencyModifier = 0
        end
    end
end)

-- Function to set walk speed
local function setWalkSpeed(character)
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if humanoid then
        humanoid.WalkSpeed = 10
    end
end

-- Function to attach orange light to the player
local function attachOrangeLight(character)
    local rootPart = character:FindFirstChild("HumanoidRootPart") or character:FindFirstChild("Head")
    if rootPart then
        -- Remove existing light if any
        local existingLight = rootPart:FindFirstChild("PlayerOrangeLight")
        if existingLight then
            existingLight:Destroy()
        end
        -- Create new light
        local light = Instance.new("PointLight")
        light.Name = "PlayerOrangeLight"
        light.Color = Color3.fromRGB(255, 165, 0) -- orange
        light.Brightness = 2
        light.Range = 10
        light.Parent = rootPart
    end
end

local function setupPlayer(character)
    setWalkSpeed(character)
    attachOrangeLight(character)
end

-- When the character spawns or respawns
local function onCharacterAdded(character)
    -- Wait for parts to load
    wait(1)
    setupPlayer(character)
end

-- Initial setup if character exists
if plr.Character then
    onCharacterAdded(plr.Character)
end

-- Setup for future respawns
plr.CharacterAdded:Connect(function(character)
    onCharacterAdded(character)
end)

-- Add flashlight (SpotLight attached to the camera) - **NOT included as per request**
--[[
local function addFlashlight()
    local flashlight = Instance.new("SpotLight")
    flashlight.Name = "PlayerFlashlight"
    flashlight.Brightness = 10
    flashlight.Angle = 60 -- wider angle for a flashlight beam
    flashlight.Range = 50
    flashlight.FaceCamera = true -- makes it face the camera direction
    flashlight.Shadows = true
    flashlight.Parent = camera -- parent to camera so it moves with it
    return flashlight
end

local flashlight = addFlashlight()
]]

local function addVHSEffect()
    local effectsFolder = Instance.new("Folder")
    effectsFolder.Name = "VHSEffects"
    effectsFolder.Parent = lighting

    -- Color correction for VHS-like distortion
    local colorCorrection = Instance.new("ColorCorrectionEffect")
    colorCorrection.Brightness = 0
    colorCorrection.Contrast = 0.2
    colorCorrection.Saturation = 0.2
    colorCorrection.TintColor = Color3.new(1, 1, 1)
    colorCorrection.Parent = lighting

    -- Bloom for glow
    local bloom = Instance.new("BloomEffect")
    bloom.Intensity = 0.3
    bloom.Threshold = 1
    bloom.Size = 24
    bloom.Parent = lighting

    -- Flickering effect via script
    spawn(function()
        while true do
            local flicker = math.random(950, 1050) / 1000 -- flicker strength
            colorCorrection.Brightness = flicker - 1
            wait(math.random(5, 15) / 100)
        end
    end)

    -- Create a ScreenGui overlay with noise (fully transparent)
    local screenGui = Instance.new("ScreenGui")
    screenGui.Name = "VHSOverlay"
    screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

    local overlay = Instance.new("Frame")
    overlay.Size = UDim2.new(1, 0, 1, 0)
    overlay.BackgroundColor3 = Color3.new(0, 0, 0)
    overlay.BackgroundTransparency = 1 -- fully transparent
    overlay.ZIndex = 10
    overlay.Parent = screenGui
end

local function setupEnvironment()
    -- Lock camera to first person
    local player = game.Players.LocalPlayer
    local character = player.Character or player.CharacterAdded:Wait()
    local workspace = game:GetService("Workspace")
    local lighting = game:GetService("Lighting")
    local soundService = game:GetService("SoundService")
    local runService = game:GetService("RunService")

    player.CameraMode = Enum.CameraMode.LockFirstPerson
    if character:FindFirstChildOfClass("Humanoid") then
        character.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
    end

    -- Remove existing Sky
    local sky = lighting:FindFirstChildOfClass("Sky")
    if sky then
        sky:Destroy()
    end

    -- Set environment to dark and less fog
    lighting.Ambient = Color3.new(0, 0, 0)
    lighting.OutdoorAmbient = Color3.new(0, 0, 0)
    lighting.TimeOfDay = "00:00:00"
    lighting.FogColor = Color3.new(0, 0, 0)
    -- Make fog less thick by increasing FogEnd
    lighting.FogStart = 10
    lighting.FogEnd = 200 -- increased for less fog density

    -- Stop all existing sounds
    for _, sound in pairs(soundService:GetChildren()) do
        if sound:IsA("Sound") then
            sound:Stop()
        end
    end

    -- Play background music
    local music = Instance.new("Sound")
    music.SoundId = "rbxassetid://133838630142849" -- your music asset ID
    music.Volume = 0.5
    music.Looped = true
    music.Parent = soundService
    music:Play()

    -- Create ScreenGui for VHS with spinning VHS image
    local screenGui = Instance.new("ScreenGui")
    screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")

    local imageLabel = Instance.new("ImageLabel")
    imageLabel.Size = UDim2.new(2, 0, 4, 0)
    imageLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
    imageLabel.AnchorPoint = Vector2.new(0.5, 0.5)
    imageLabel.BackgroundTransparency = 1
    imageLabel.Image = "rbxassetid://2510585515" -- your VHS image asset ID
    imageLabel.ImageTransparency = 0.9
    imageLabel.ZIndex = 1
    imageLabel.Parent = screenGui

    -- Spin the VHS image continuously
    local angle = 0
    local spinSpeed = 90 -- degrees per second
    runService.RenderStepped:Connect(function()
        angle = (angle + spinSpeed * runService.Heartbeat:Wait()) % 360
        imageLabel.Rotation = angle
    end)

    -- Add VHS visual effects
    addVHSEffect()

    -- Create inward panels with doubled size
    local baseWidthPercent = 0.15 -- original width
    local expandedWidthPercent = baseWidthPercent * 2 -- doubled width
    local expandedHeightFactor = 2 -- doubled height

    -- Left panel inward
    local leftPanel = Instance.new("Frame")
    leftPanel.Size = UDim2.new(expandedWidthPercent, 0, expandedHeightFactor, 0)
    leftPanel.AnchorPoint = Vector2.new(0.5, 0.5)
    leftPanel.Position = UDim2.new(0, 0, 0.5, 0)
    leftPanel.BackgroundColor3 = Color3.new(0, 0, 0)
    leftPanel.BackgroundTransparency = 0
    leftPanel.ZIndex = 10
    leftPanel.Parent = screenGui

    -- Right panel inward
    local rightPanel = Instance.new("Frame")
    rightPanel.Size = UDim2.new(expandedWidthPercent, 0, expandedHeightFactor, 0)
    rightPanel.AnchorPoint = Vector2.new(0.5, 0.5)
    rightPanel.Position = UDim2.new(1, 0, 0.5, 0)
    rightPanel.BackgroundColor3 = Color3.new(0, 0, 0)
    rightPanel.BackgroundTransparency = 0
    rightPanel.ZIndex = 10
    rightPanel.Parent = screenGui
end

-- Run setup initially
setupEnvironment()

-- Re-setup on respawn
game.Players.LocalPlayer.CharacterAdded:Connect(function()
    wait(1)
    setupEnvironment()
end)

Features & Information

Scare

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts