Advertisement
OEAgamer1

How to give a tool to an other player in Roblox Studio

Jan 11th, 2024
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. local tool = script.Parent
  2.  
  3. local canGive
  4.  
  5.  
  6.  
  7. local function onTouch(otherPart)
  8.  
  9.     local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
  10.  
  11.     if humanoid then
  12.  
  13.         if humanoid.Parent ~= tool.Parent and canGive then
  14.  
  15.             canGive = false
  16.  
  17.             tool.Parent = humanoid.Parent
  18.  
  19.         end
  20.  
  21.     end
  22.  
  23. end
  24.  
  25.  
  26.  
  27. local function slash()
  28.  
  29.     local str = Instance.new("StringValue")
  30.  
  31.     str.Name = "toolanim"
  32.  
  33.     str.Value = "Slash"
  34.  
  35.     str.Parent = tool
  36.  
  37.     canGive = true
  38.  
  39.     wait(.5)
  40.  
  41.     canGive = false
  42.  
  43. end
  44.  
  45.  
  46.  
  47. tool.Handle.Touched:Connect(onTouch)
  48.  
  49. tool.Activated:Connect(slash)
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement