Pastebin

Paste #38867: No description

< previous paste - next paste>

Pasted by Anonymous Coward

Download View as text

-- Enhanced Steal a Freddy Script with Rayfield UI
-- Improved performance, error handling, and user experience

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local LocalPlayer = Players.LocalPlayer

-- Load Rayfield UI Library
local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()

-- Enhanced Configuration
getgenv().Config = getgenv().Config or {
    speed = 20,
    godMode = true,
    noclip = true,
    autoRespawn = true,
    teleportParticles = true,
    smoothTeleport = true
}

-- Enhanced Variables
local Character, Humanoid, RootPart
local Mouse = LocalPlayer:GetMouse()
local Connections = {}
local TeleportTool
local currentTween

-- Utility Functions
local function safeWait(timeout)
    local start = tick()
    while not Character or not RootPart and (tick() - start) < (timeout or 5) do
        wait(0.1)
    end
    return Character and RootPart
end

local function createNotification(title, content, duration)
    Rayfield:Notify({
        Title = title,
        Content = content,
        Duration = duration or 3,
        Image = 4483362458
    })
end

local function cleanupConnections()
    for name, connection in pairs(Connections) do
        if connection then
            connection:Disconnect()
            Connections[name] = nil
        end
    end
end

local function applyNoclip(enable)
    if not Character then return end
    
    for _, part in pairs(Character:GetDescendants()) do
        if part:IsA("BasePart") and part ~= RootPart then
            part.CanCollide = not enable
        end
    end
end

local function applyGodMode(enable)
    if not Humanoid then return end
    
    if enable then
        Humanoid.MaxHealth = math.huge
        Humanoid.Health = Humanoid.MaxHealth
        
        if Connections.GodMode then Connections.GodMode:Disconnect() end
        Connections.GodMode = Humanoid.HealthChanged:Connect(function()
            if Humanoid.Health < Humanoid.MaxHealth then
                Humanoid.Health = Humanoid.MaxHealth
            end
        end)
    else
        if Connections.GodMode then 
            Connections.GodMode:Disconnect() 
            Connections.GodMode = nil
        end
        Humanoid.MaxHealth = 100
        Humanoid.Health = 100
    end
end

local function createTeleportParticles(position)
    if not getgenv().Config.teleportParticles then return end
    
    local part = Instance.new("Part")
    part.Name = "TeleportEffect"
    part.Size = Vector3.new(0.1, 0.1, 0.1)
    part.Position = position
    part.Anchored = true
    part.CanCollide = false
    part.Transparency = 1
    part.Parent = workspace
    
    local attachment = Instance.new("Attachment")
    attachment.Parent = part
    
    -- Create particle effect
    local particles = Instance.new("ParticleEmitter")
    particles.Parent = attachment
    particles.Texture = "rbxasset://textures/particles/sparkles_main.dds"
    particles.Lifetime = NumberRange.new(0.5, 1.0)
    particles.Rate = 100
    particles.SpreadAngle = Vector2.new(45, 45)
    particles.Speed = NumberRange.new(5, 10)
    particles.Color = ColorSequence.new(Color3.fromRGB(0, 162, 255), Color3.fromRGB(255, 255, 255))
    
    -- Cleanup after 2 seconds
    game:GetService("Debris"):AddItem(part, 2)
    
    wait(0.1)
    particles.Enabled = false
end

local function smoothTeleport(targetCFrame, speed)
    if not RootPart then return end
    if currentTween then currentTween:Cancel() end
    
    local distance = (targetCFrame.Position - RootPart.Position).Magnitude
    local duration = distance / speed
    
    -- Create teleport particles at start position
    createTeleportParticles(RootPart.Position)
    
    if getgenv().Config.smoothTeleport and duration > 0.1 then
        local info = TweenInfo.new(
            duration,
            Enum.EasingStyle.Quint,
            Enum.EasingDirection.Out,
            0,
            false,
            0
        )
        
        currentTween = TweenService:Create(RootPart, info, {CFrame = targetCFrame})
        currentTween:Play()
        
        currentTween.Completed:Connect(function()
            createTeleportParticles(RootPart.Position)
            currentTween = nil
        end)
    else
        RootPart.CFrame = targetCFrame
        createTeleportParticles(RootPart.Position)
    end
end

local function createTeleportTool()
    if TeleportTool then TeleportTool:Destroy() end
    
    TeleportTool = Instance.new("Tool")
    TeleportTool.RequiresHandle = false
    TeleportTool.Name = "๐Ÿš€ Enhanced Teleport Tool"
    TeleportTool.ToolTip = "Click to teleport to mouse position"
    
    local activated = false
    TeleportTool.Activated:Connect(function()
        if activated then return end
        activated = true
        
        local hit = Mouse.Hit
        if hit then
            local targetPosition = hit.Position + Vector3.new(0, 5, 0)
            local targetCFrame = CFrame.new(targetPosition)
            smoothTeleport(targetCFrame, getgenv().Config.speed)
        end
        
        wait(0.1)
        activated = false
    end)
    
    return TeleportTool
end

local function setupCharacter(character)
    Character = character
    Humanoid = Character:WaitForChild("Humanoid", 5)
    RootPart = Character:WaitForChild("HumanoidRootPart", 5)
    
    if not Humanoid or not RootPart then
        warn("Failed to setup character components")
        return
    end
    
    -- Apply configurations
    if getgenv().Config.noclip then
        applyNoclip(true)
        
        -- Continuous noclip for new parts
        Connections.Noclip = Character.DescendantAdded:Connect(function(descendant)
            if descendant:IsA("BasePart") and descendant ~= RootPart then
                descendant.CanCollide = false
            end
        end)
    end
    
    if getgenv().Config.godMode then
        applyGodMode(true)
    end
    
    -- Auto-respawn feature
    if getgenv().Config.autoRespawn then
        Connections.AutoRespawn = Humanoid.Died:Connect(function()
            wait(1)
            LocalPlayer:LoadCharacter()
        end)
    end
    
    createNotification("Character Setup", "Enhanced features applied successfully!", 2)
end

-- Character Management
if LocalPlayer.Character then
    setupCharacter(LocalPlayer.Character)
end

LocalPlayer.CharacterAdded:Connect(function(character)
    cleanupConnections()
    wait(0.5) -- Allow character to fully load
    setupCharacter(character)
end)

LocalPlayer.CharacterRemoving:Connect(function()
    cleanupConnections()
    if currentTween then
        currentTween:Cancel()
        currentTween = nil
    end
end)

-- Create Rayfield GUI
local Window = Rayfield:CreateWindow({
    Name = "๐ŸŽฎ Enhanced Steal a Freddy Script",
    LoadingTitle = "Loading Enhanced Script...",
    LoadingSubtitle = "by Enhanced Developer",
    ConfigurationSaving = {
        Enabled = true,
        FolderName = "StealAFreddyEnhanced",
        FileName = "Config"
    }
})

-- Main Tab
local MainTab = Window:CreateTab("๐Ÿ  Main", 4483362458)

-- Teleport Section
local TeleportSection = MainTab:CreateSection("๐Ÿš€ Teleportation")

local TeleportButton = MainTab:CreateButton({
    Name = "๐Ÿ› ๏ธ Give Enhanced Teleport Tool",
    Callback = function()
        local tool = createTeleportTool()
        if LocalPlayer.Backpack:FindFirstChild(tool.Name) then
            LocalPlayer.Backpack:FindFirstChild(tool.Name):Destroy()
        end
        tool.Parent = LocalPlayer.Backpack
        createNotification("Tool Given", "Enhanced teleport tool added to backpack!", 2)
    end,
})

local SpeedSlider = MainTab:CreateSlider({
    Name = "โšก Teleport Speed",
    Range = {10, 500},
    Increment = 5,
    Suffix = " studs/sec",
    CurrentValue = getgenv().Config.speed,
    Flag = "TeleportSpeed",
    Callback = function(value)
        getgenv().Config.speed = value
    end,
})

local SmoothToggle = MainTab:CreateToggle({
    Name = "๐ŸŒŠ Smooth Teleportation",
    CurrentValue = getgenv().Config.smoothTeleport,
    Flag = "SmoothTeleport",
    Callback = function(value)
        getgenv().Config.smoothTeleport = value
    end,
})

local ParticlesToggle = MainTab:CreateToggle({
    Name = "โœจ Teleport Particles",
    CurrentValue = getgenv().Config.teleportParticles,
    Flag = "TeleportParticles",
    Callback = function(value)
        getgenv().Config.teleportParticles = value
    end,
})

-- Player Enhancements Section
local PlayerSection = MainTab:CreateSection("๐Ÿ‘ค Player Enhancements")

local GodModeToggle = MainTab:CreateToggle({
    Name = "๐Ÿ›ก๏ธ God Mode",
    CurrentValue = getgenv().Config.godMode,
    Flag = "GodMode",
    Callback = function(value)
        getgenv().Config.godMode = value
        applyGodMode(value)
        createNotification("God Mode", value and "Enabled" or "Disabled", 1.5)
    end,
})

local NoclipToggle = MainTab:CreateToggle({
    Name = "๐Ÿ‘ป Noclip",
    CurrentValue = getgenv().Config.noclip,
    Flag = "Noclip",
    Callback = function(value)
        getgenv().Config.noclip = value
        applyNoclip(value)
        createNotification("Noclip", value and "Enabled" or "Disabled", 1.5)
    end,
})

local AutoRespawnToggle = MainTab:CreateToggle({
    Name = "๐Ÿ”„ Auto Respawn",
    CurrentValue = getgenv().Config.autoRespawn,
    Flag = "AutoRespawn",
    Callback = function(value)
        getgenv().Config.autoRespawn = value
        createNotification("Auto Respawn", value and "Enabled" or "Disabled", 1.5)
    end,
})

-- Utilities Tab
local UtilsTab = Window:CreateTab("๐Ÿ”ง Utilities", 4483362458)

local UtilsSection = UtilsTab:CreateSection("๐Ÿ› ๏ธ Useful Tools")

local RespawnButton = UtilsTab:CreateButton({
    Name = "๐Ÿ”„ Respawn Character",
    Callback = function()
        LocalPlayer:LoadCharacter()
        createNotification("Respawning", "Character is being respawned...", 2)
    end,
})

local ResetToolsButton = UtilsTab:CreateButton({
    Name = "๐Ÿงน Clear Tools",
    Callback = function()
        for _, tool in pairs(LocalPlayer.Backpack:GetChildren()) do
            if tool:IsA("Tool") then
                tool:Destroy()
            end
        end
        createNotification("Tools Cleared", "All tools removed from backpack!", 2)
    end,
})

local TPToSpawnButton = UtilsTab:CreateButton({
    Name = "๐Ÿ  Teleport to Spawn",
    Callback = function()
        if RootPart then
            local spawnLocation = workspace.SpawnLocation or CFrame.new(0, 50, 0)
            local targetCFrame = spawnLocation.CFrame or CFrame.new(spawnLocation.Position + Vector3.new(0, 5, 0))
            smoothTeleport(targetCFrame, getgenv().Config.speed)
            createNotification("Teleported", "Moved to spawn location!", 2)
        end
    end,
})

-- Info Tab
local InfoTab = Window:CreateTab("โ„น๏ธ Information", 4483362458)

local InfoSection = InfoTab:CreateSection("๐Ÿ“‹ Script Information")

InfoTab:CreateParagraph({Name = "๐ŸŽฎ Script Features", Content = "โ€ข Enhanced teleport tool with particles\nโ€ข Smooth teleportation animations\nโ€ข God mode with infinite health\nโ€ข Noclip for walking through walls\nโ€ข Auto respawn on death\nโ€ข Customizable teleport speed\nโ€ข Clean and modern UI"})

InfoTab:CreateParagraph({Name = "๐ŸŽฏ How to Use", Content = "1. Enable desired features using toggles\n2. Get the teleport tool from Main tab\n3. Equip the tool and click to teleport\n4. Adjust speed with the slider\n5. Use utilities for additional functions"})

local StatusSection = InfoTab:CreateSection("๐Ÿ“Š Status")

local StatusLabel = InfoTab:CreateLabel("Status: Script Loaded Successfully! โœ…")

-- Update status periodically
spawn(function()
    while true do
        wait(1)
        if StatusLabel then
            local status = string.format(
                "Player: %s | Speed: %d | Health: %s",
                LocalPlayer.Name,
                getgenv().Config.speed,
                (Humanoid and Humanoid.Health == math.huge) and "โˆž" or (Humanoid and math.floor(Humanoid.Health) or "N/A")
            )
            StatusLabel:Set(status)
        end
    end
end)

-- Cleanup on script end
game.Players.PlayerRemoving:Connect(function(player)
    if player == LocalPlayer then
        cleanupConnections()
    end
end)

-- Initial notification
createNotification("Script Loaded", "Enhanced Steal a Freddy Script loaded successfully!", 3)

print("Enhanced Steal a Freddy Script loaded with Rayfield UI!")

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.