crpishim

Untitled

Mar 9th, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.26 KB | None | 0 0
  1. -- Football Fusion 2 Utility Script
  2. -- This script provides various utility functions for Football Fusion 2
  3. -- Note: This is for educational purposes only
  4.  
  5. local FF2Utility = {}
  6.  
  7. -- Player Variables
  8. local Players = game:GetService("Players")
  9. local LocalPlayer = Players.LocalPlayer
  10. local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
  11. local Humanoid = Character:WaitForChild("Humanoid")
  12. local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
  13.  
  14. -- Game Services
  15. local UserInputService = game:GetService("UserInputService")
  16. local RunService = game:GetService("RunService")
  17. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  18.  
  19. -- Configuration (Adjust these settings as needed)
  20. FF2Utility.Settings = {
  21.     ShowFieldOverlay = false,
  22.     AutoCatch = false,
  23.     AutoJuke = false,
  24.     HighlightTeammates = true,
  25.     DisplayRoutes = true,
  26.     SprintToggle = true,
  27.     CustomCameraZoom = 15,
  28.     PerformanceMode = false
  29. }
  30.  
  31. -- Route visualization for receivers
  32. function FF2Utility:VisualizeRoutes()
  33.     if not self.Settings.DisplayRoutes then return end
  34.    
  35.     -- Clear previous route visualizations
  36.     if self.RouteVisualization then
  37.         for _, visual in pairs(self.RouteVisualization) do
  38.             visual:Destroy()
  39.         end
  40.     end
  41.    
  42.     self.RouteVisualization = {}
  43.    
  44.     -- Find all teammates who are receivers
  45.     local myTeam = LocalPlayer.Team
  46.     for _, player in pairs(Players:GetPlayers()) do
  47.         if player.Team == myTeam and player ~= LocalPlayer then
  48.             local char = player.Character
  49.             if char and char:FindFirstChild("Role") and char.Role.Value == "Receiver" then
  50.                 -- Create route visualization
  51.                 local routeAttachment = Instance.new("Attachment")
  52.                 routeAttachment.Parent = workspace
  53.                
  54.                 local trail = Instance.new("Trail")
  55.                 trail.Attachment0 = routeAttachment
  56.                 trail.Attachment1 = char.HumanoidRootPart.RootAttachment
  57.                 trail.Color = ColorSequence.new(Color3.fromRGB(0, 255, 0))
  58.                 trail.Transparency = NumberSequence.new(0.5)
  59.                 trail.Lifetime = 2
  60.                 trail.Parent = workspace
  61.                
  62.                 table.insert(self.RouteVisualization, routeAttachment)
  63.                 table.insert(self.RouteVisualization, trail)
  64.             end
  65.         end
  66.     end
  67. end
  68.  
  69. -- Enhanced catching mechanics
  70. function FF2Utility:SetupCatchingMechanics()
  71.     if not self.Settings.AutoCatch then return end
  72.    
  73.     -- Connect to the football being thrown event
  74.     if ReplicatedStorage:FindFirstChild("Events") and
  75.        ReplicatedStorage.Events:FindFirstChild("FootballThrown") then
  76.        
  77.         ReplicatedStorage.Events.FootballThrown.OnClientEvent:Connect(function(footballObj)
  78.             if footballObj and LocalPlayer.Character and
  79.                LocalPlayer.Character:FindFirstChild("Role") and
  80.                LocalPlayer.Character.Role.Value == "Receiver" then
  81.                
  82.                 -- Calculate if the ball is coming toward the player
  83.                 local ballPosition = footballObj.Position
  84.                 local playerPosition = HumanoidRootPart.Position
  85.                 local distanceToPlayer = (ballPosition - playerPosition).Magnitude
  86.                
  87.                 -- Start tracking the football
  88.                 RunService:BindToRenderStep("TrackFootball", Enum.RenderPriority.Camera.Value, function()
  89.                     if not footballObj or not footballObj.Parent then
  90.                         RunService:UnbindFromRenderStep("TrackFootball")
  91.                         return
  92.                     end
  93.                    
  94.                     local newDistance = (footballObj.Position - HumanoidRootPart.Position).Magnitude
  95.                    
  96.                     -- If the ball is getting closer and within catch range
  97.                     if newDistance < distanceToPlayer and newDistance < 10 then
  98.                         -- Trigger catch attempt
  99.                         local catchSuccess = self:AttemptCatch(footballObj)
  100.                         if catchSuccess then
  101.                             RunService:UnbindFromRenderStep("TrackFootball")
  102.                         end
  103.                     end
  104.                    
  105.                     distanceToPlayer = newDistance
  106.                 end)
  107.             end
  108.         end)
  109.     end
  110. end
  111.  
  112. -- Attempt to catch the football
  113. function FF2Utility:AttemptCatch(football)
  114.     if not football or not self.Settings.AutoCatch then return false end
  115.    
  116.     -- Face toward the football
  117.     local ballDirection = (football.Position - HumanoidRootPart.Position).Unit
  118.     HumanoidRootPart.CFrame = CFrame.lookAt(HumanoidRootPart.Position, HumanoidRootPart.Position + ballDirection)
  119.    
  120.     -- Simulate catch button press if within range
  121.     local catchDistance = (football.Position - HumanoidRootPart.Position).Magnitude
  122.     if catchDistance <= 8 then
  123.         -- This would normally trigger the catch remote event
  124.         -- For educational purposes, we're just showing where it would happen
  125.         print("Catch attempted")
  126.         return true
  127.     end
  128.    
  129.     return false
  130. end
  131.  
  132. -- Field position overlay
  133. function FF2Utility:CreateFieldOverlay()
  134.     if not self.Settings.ShowFieldOverlay then return end
  135.    
  136.     if self.FieldOverlay then
  137.         self.FieldOverlay:Destroy()
  138.     end
  139.    
  140.     self.FieldOverlay = Instance.new("ScreenGui")
  141.     self.FieldOverlay.Name = "FieldPositionOverlay"
  142.     self.FieldOverlay.Parent = LocalPlayer:WaitForChild("PlayerGui")
  143.    
  144.     local yardLines = Instance.new("Frame")
  145.     yardLines.Name = "YardLines"
  146.     yardLines.Size = UDim2.new(0, 150, 0, 40)
  147.     yardLines.Position = UDim2.new(1, -170, 0, 20)
  148.     yardLines.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  149.     yardLines.BackgroundTransparency = 0.7
  150.     yardLines.Parent = self.FieldOverlay
  151.    
  152.     local positionText = Instance.new("TextLabel")
  153.     positionText.Name = "PositionText"
  154.     positionText.Size = UDim2.new(1, 0, 1, 0)
  155.     positionText.BackgroundTransparency = 1
  156.     positionText.TextColor3 = Color3.fromRGB(255, 255, 255)
  157.     positionText.Font = Enum.Font.SourceSansBold
  158.     positionText.TextSize = 16
  159.     positionText.Text = "Field Position: Unknown"
  160.     positionText.Parent = yardLines
  161.    
  162.     -- Update field position
  163.     RunService:BindToRenderStep("UpdateFieldPosition", Enum.RenderPriority.Character.Value, function()
  164.         if Character and HumanoidRootPart then
  165.             -- This would calculate actual field position based on the game's field coordinates
  166.             -- For demo purposes, using placeholder values
  167.             local yardLine = math.random(1, 50)
  168.             local side = (math.random(1, 2) == 1) and "Home" or "Away"
  169.             positionText.Text = string.format("Field Position: %s %d", side, yardLine)
  170.         end
  171.     end)
  172. end
  173.  
  174. -- Team highlighting
  175. function FF2Utility:HighlightTeammates()
  176.     if not self.Settings.HighlightTeammates then return end
  177.    
  178.     -- Clear existing highlights
  179.     if self.TeamHighlights then
  180.         for player, highlight in pairs(self.TeamHighlights) do
  181.             highlight:Destroy()
  182.         end
  183.     end
  184.    
  185.     self.TeamHighlights = {}
  186.    
  187.     -- Create new highlights for current teammates
  188.     local myTeam = LocalPlayer.Team
  189.     for _, player in pairs(Players:GetPlayers()) do
  190.         if player.Team == myTeam and player ~= LocalPlayer then
  191.             local char = player.Character
  192.             if char then
  193.                 local highlight = Instance.new("Highlight")
  194.                 highlight.FillColor = Color3.fromRGB(0, 255, 0)
  195.                 highlight.OutlineColor = Color3.fromRGB(0, 255, 0)
  196.                 highlight.FillTransparency = 0.8
  197.                 highlight.OutlineTransparency = 0.5
  198.                 highlight.Parent = char
  199.                
  200.                 self.TeamHighlights[player] = highlight
  201.             end
  202.         end
  203.     end
  204.    
  205.     -- Update highlights when players join/leave
  206.     Players.PlayerAdded:Connect(function(player)
  207.         if player.Team == myTeam then
  208.             local char = player.Character or player.CharacterAdded:Wait()
  209.             local highlight = Instance.new("Highlight")
  210.             highlight.FillColor = Color3.fromRGB(0, 255, 0)
  211.             highlight.OutlineColor = Color3.fromRGB(0, 255, 0)
  212.             highlight.FillTransparency = 0.8
  213.             highlight.OutlineTransparency = 0.5
  214.             highlight.Parent = char
  215.            
  216.             self.TeamHighlights[player] = highlight
  217.         end
  218.     end)
  219. end
  220.  
  221. -- Initialize and run the utility
  222. function FF2Utility:Initialize()
  223.     print("Football Fusion 2 Utility initialized")
  224.    
  225.     self:CreateFieldOverlay()
  226.     self:HighlightTeammates()
  227.     self:SetupCatchingMechanics()
  228.    
  229.     -- Set custom camera zoom
  230.     LocalPlayer.CameraMaxZoomDistance = self.Settings.CustomCameraZoom
  231.    
  232.     -- Performance mode
  233.     if self.Settings.PerformanceMode then
  234.         settings().Rendering.QualityLevel = 1
  235.     end
  236.    
  237.     -- Update route visualization periodically
  238.     spawn(function()
  239.         while true do
  240.             self:VisualizeRoutes()
  241.             wait(5)
  242.         end
  243.     end)
  244.    
  245.     print("All utility functions loaded successfully")
  246. end
  247.  
  248. return FF2Utility
Add Comment
Please, Sign In to add comment