Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 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!
- local StarterGui = game:GetService('StarterGui')
- StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
- local Player = game.Players.LocalPlayer
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local Humanoid = Character.Humanoid
- local WEAPON = Player.Backpack['LinkedSword'] -- Name of weapon here. Mine is LinkedSword
- local Areas = workspace.Areas
- local HumanoidRootPart = Character:WaitForChild('HumanoidRootPart')
- local GotSword = false
- TOUCHING = nil
- HumanoidRootPart.Touched:Connect(function(newPart)
- if newPart:IsDescendantOf(Areas) and TOUCHING == nil then
- TOUCHING = newPart
- if GotSword == false then
- Humanoid:EquipTool(WEAPON)
- GotSword = true
- end
- end
- end)
- HumanoidRootPart.TouchEnded:Connect(function()
- for _, part in pairs(HumanoidRootPart:GetTouchingParts()) do
- if part == TOUCHING then return end
- end
- Humanoid:UnequipTools()
- TOUCHING = nil
- GotSword = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement