Advertisement
Previized

Fighting Arena Script

Jan 13th, 2021 (edited)
12,776
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. -- The 2 lines below basically disables you from looking at your weapons/tools in game. You can remove these 2 lines if you want all your weapons in game to show!
  2. local StarterGui = game:GetService('StarterGui')
  3. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
  4.  
  5. local Player = game.Players.LocalPlayer
  6. local Character = Player.Character or Player.CharacterAdded:Wait()
  7. local Humanoid = Character.Humanoid
  8.  
  9. local WEAPON = Player.Backpack['LinkedSword'] -- Name of weapon here. Mine is LinkedSword
  10.  
  11. local Areas = workspace.Areas
  12. local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart')
  13.  
  14. local GotSword = false
  15.  
  16. TOUCHING = nil
  17. HumanoidRootPart.Touched:Connect(function(newPart)
  18.     if newPart:IsDescendantOf(Areas) and TOUCHING == nil then
  19.         TOUCHING = newPart
  20.         if GotSword == false then
  21.             Humanoid:EquipTool(WEAPON)
  22.             GotSword = true
  23.         end
  24.     end
  25. end)
  26.  
  27. HumanoidRootPart.TouchEnded:Connect(function()
  28.     for _, part in pairs(HumanoidRootPart:GetTouchingParts()) do
  29.         if part == TOUCHING then return end
  30.     end
  31.     Humanoid:UnequipTools()
  32.     TOUCHING = nil
  33.     GotSword = false
  34. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement