The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Treasure Quest script pastebin roblox
By LINK GAME on 2024-09-20 08:00 am | Syntax: LUA | Views: 14



New Script | Raw | Show/Hide line no. | Copy text to clipboard
  1. --// Settings \\--
  2. Distance = 7.5
  3.  
  4. --// Service \\--
  5. local RunService = game:GetService("RunService")
  6. local Workspace = game:GetService("Workspace")
  7. local Players = game:GetService("Players")
  8.  
  9. --// Variables \\--
  10. local Player = Players.LocalPlayer
  11. local Rotation = Distance > 0 and -90 or 90
  12. local CanTouch = type(firetouchinterest) == "function"
  13.  
  14. --// Module Stuff \\--
  15. local Module = require(Player.PlayerScripts.Shared.Client.CombatController)
  16. local Attack = Module.BasicAttack
  17. local Ability = Module.UseAbility
  18.  
  19. --// NoClip \\--
  20. RunService.RenderStepped:Connect(function()
  21.     Player.Character.Humanoid:ChangeState(11)
  22. end)
  23.  
  24. --// Collect Medkits \\--
  25. if CanTouch then
  26.     Workspace:WaitForChild("Ignore").ChildAdded:Connect(function(A_1)
  27.         if A_1.Name == "Medkit" and A_1:WaitForChild("TouchInterest",5) then
  28.             repeat wait(0.2) until pcall(function() return Player.Character.Humanoid.Health < Player.Character.Humanoid.MaxHealth end)
  29.             pcall(function()
  30.                 firetouchinterest(Player.Character.HumanoidRootPart,A_1,0)
  31.                 firetouchinterest(Player.Character.HumanoidRootPart,A_1,1)      
  32.             end)
  33.         end
  34.     end)
  35. end
  36.  
  37. --// Filter Enemies \\--
  38. function GetEnemy()
  39.     local Enemies = Workspace:GetDescendants()
  40.     local Lowest = math.huge
  41.     local Selected = nil
  42.     for _ = 1, #Enemies do local Model = Enemies[_]
  43.         local Humanoid = Model:FindFirstChildOfClass("Humanoid")
  44.         if Humanoid and Humanoid.Health > 0 and Humanoid.Health < Lowest and Model:IsA("Model") and Model.PrimaryPart and not Players:GetPlayerFromCharacter(Model) then
  45.             Lowest = Humanoid.Health
  46.             Selected = Model
  47.         end
  48.     end
  49.     return Selected
  50. end
  51.  
  52. --// Attack \\--
  53. while wait() do
  54.     -- Get Enemies
  55.     local EnemyFound = false
  56.     local Model = GetEnemy()
  57.     if Model then
  58.         local Humanoid = Model:FindFirstChildOfClass("Humanoid")
  59.         -- Kill
  60.         repeat
  61.             -- Teleport
  62.             pcall(function()
  63.                 Player.Character.HumanoidRootPart.CFrame = CFrame.new(Model.PrimaryPart.Position) * CFrame.Angles(math.rad(Rotation), 0, 0) + Vector3.new(0, Distance, 0)
  64.             end)
  65.             wait()
  66.             -- Attack
  67.             Attack(Module)
  68.             pcall(function()
  69.                 Ability(Module,Model.PrimaryPart.Position)
  70.             end)
  71.         until not Model.Parent or Humanoid.Health <= 0 or Model.PrimaryPart == nil
  72.     else
  73.         -- Start & Finish
  74.         game:GetService("ReplicatedStorage").Dungeon.Remotes.StartDungeon:FireServer()
  75.         game:GetService("ReplicatedStorage").Shared.Remotes.Data.ClaimPrizes:FireServer()
  76.         -- Finish
  77.         local Finish = Workspace:FindFirstChild("FinishRoom",true)
  78.         if Finish then
  79.             pcall(function()
  80.                 Player.Character.HumanoidRootPart.CFrame = Finish.Hitbox.Part.CFrame
  81.             end)
  82.         end
  83.     end
  84.     -- Get Treasure
  85.     if CanTouch then
  86.         local Chests = Workspace:GetDescendants()
  87.         for _ = 1, #Chests do local Chest = Chests[_]
  88.             if Chest.Name == "Chest" and Chest:FindFirstChild("Hitbox") and Chest.Hitbox:FindFirstChild("TouchInterest") then
  89.                 pcall(function()
  90.                     firetouchinterest(Player.Character.HumanoidRootPart,Chest.Hitbox,0)
  91.                     firetouchinterest(Player.Character.HumanoidRootPart,Chest.Hitbox,1)
  92.                 end)
  93.             end
  94.         end
  95.     end
  96. end