-- Wait for game to load properly if not game:IsLoaded() then game.Loaded:Wait() end local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local Workspace = game:GetService("Workspace") local player = Players.LocalPlayer local camera = Workspace.CurrentCamera -- Cleanup precedenti local oldGui = player:WaitForChild("PlayerGui"):FindFirstChild("XenoFreecamNotification") if oldGui then oldGui:Destroy() end -- Settings local baseSpeed = 50 local isFreecamActive = false local cameraCFrame = CFrame.new() local targetVelocity = Vector3.new(0, 0, 0) local currentVelocity = Vector3.new(0, 0, 0) local cameraYaw = 0 local cameraPitch = 0 local sensitivity = 0.3 -- Notifica GUI (Scale Only) local screenGui = Instance.new("ScreenGui") screenGui.Name = "XenoFreecamNotification" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local notificationFrame = Instance.new("Frame") notificationFrame.Name = "NotificationFrame" notificationFrame.Size = UDim2.new(0.22, 0, 0.06, 0) notificationFrame.Position = UDim2.new(0.76, 0, 0.9, 0) notificationFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 25) notificationFrame.BackgroundTransparency = 0.1 notificationFrame.BorderSizePixel = 0 notificationFrame.Parent = screenGui local uiCorner = Instance.new("UICorner") uiCorner.CornerRadius = UDim.new(0.2, 0) uiCorner.Parent = notificationFrame local statusLabel = Instance.new("TextLabel") statusLabel.Name = "StatusLabel" statusLabel.Size = UDim2.new(0.9, 0, 0.8, 0) statusLabel.Position = UDim2.new(0.05, 0, 0.1, 0) statusLabel.BackgroundTransparency = 1 statusLabel.TextColor3 = Color3.fromRGB(255, 75, 75) statusLabel.TextScaled = true statusLabel.Font = Enum.Font.GothamBold statusLabel.Text = "Freecam: OFF (Shift + P)" statusLabel.Parent = notificationFrame -- Controlli Tasti local keysPressed = { W = false, A = false, S = false, D = false, E = false, Q = false } local function setCharacterVisibility(visible) local character = player.Character if not character then return end for _, part in ipairs(character:GetDescendants()) do if part:IsA("BasePart") or part:IsA("Decal") then if part.Name ~= "HumanoidRootPart" then part.LocalTransparencyModifier = visible and 0 or 1 end end end end local function toggleFreecam() isFreecamActive = not isFreecamActive if isFreecamActive then statusLabel.Text = "Freecam: ON" statusLabel.TextColor3 = Color3.fromRGB(75, 255, 120) cameraCFrame = camera.CFrame local x, y, _ = cameraCFrame:ToOrientation() cameraPitch = x cameraYaw = y camera.CameraType = Enum.CameraType.Scriptable player.CameraMode = Enum.CameraMode.LockFirstPerson if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.Anchored = true end setCharacterVisibility(false) else statusLabel.Text = "Freecam: OFF (Shift + P)" statusLabel.TextColor3 = Color3.fromRGB(255, 75, 75) camera.CameraType = Enum.CameraType.Custom player.CameraMode = Enum.CameraMode.Classic UserInputService.MouseBehavior = Enum.MouseBehavior.Default if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then player.Character.HumanoidRootPart.Anchored = false end setCharacterVisibility(true) targetVelocity = Vector3.new(0, 0, 0) currentVelocity = Vector3.new(0, 0, 0) end end -- Gestione Input Mouse UserInputService.InputChanged:Connect(function(input, gameProcessed) if not isFreecamActive then return end if input.UserInputType == Enum.UserInputType.MouseMovement then local delta = input.Delta cameraYaw = cameraYaw - math.rad(delta.X * sensitivity) cameraPitch = math.clamp(cameraPitch - math.rad(delta.Y * sensitivity), math.rad(-89), math.rad(89)) end end) -- Gestione Input Tastiera UserInputService.InputBegan:Connect(function(input, gameProcessed) -- Pressione Shift + P if input.KeyCode == Enum.KeyCode.P then if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift) then toggleFreecam() return end end if isFreecamActive then if input.KeyCode == Enum.KeyCode.W then keysPressed.W = true end if input.KeyCode == Enum.KeyCode.A then keysPressed.A = true end if input.KeyCode == Enum.KeyCode.S then keysPressed.S = true end if input.KeyCode == Enum.KeyCode.D then keysPressed.D = true end if input.KeyCode == Enum.KeyCode.E then keysPressed.E = true end if input.KeyCode == Enum.KeyCode.Q then keysPressed.Q = true end end end) UserInputService.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.W then keysPressed.W = false end if input.KeyCode == Enum.KeyCode.A then keysPressed.A = false end if input.KeyCode == Enum.KeyCode.S then keysPressed.S = false end if input.KeyCode == Enum.KeyCode.D then keysPressed.D = false end if input.KeyCode == Enum.KeyCode.E then keysPressed.E = false end if input.KeyCode == Enum.KeyCode.Q then keysPressed.Q = false end end) -- Loop di rendering RunService.RenderStepped:Connect(function(dt) if not isFreecamActive then return end setCharacterVisibility(false) UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter local rotation = CFrame.Angles(0, cameraYaw, 0) * CFrame.Angles(cameraPitch, 0, 0) local moveDir = Vector3.new(0, 0, 0) if keysPressed.W then moveDir = moveDir + rotation.LookVector end if keysPressed.S then moveDir = moveDir - rotation.LookVector end if keysPressed.D then moveDir = moveDir + rotation.RightVector end if keysPressed.A then moveDir = moveDir - rotation.RightVector end if keysPressed.E then moveDir = moveDir + Vector3.new(0, 1, 0) end if keysPressed.Q then moveDir = moveDir - Vector3.new(0, 1, 0) end if moveDir.Magnitude > 0 then moveDir = moveDir.Unit end targetVelocity = moveDir * baseSpeed currentVelocity = currentVelocity:Lerp(targetVelocity, math.clamp(dt * 10, 0, 1)) local currentPosition = cameraCFrame.Position + (currentVelocity * dt) cameraCFrame = CFrame.new(currentPosition) * rotation camera.CFrame = cameraCFrame end)