Advertisement
pa1nx9

Free Roblox Script a universal time giveitem command

Oct 3rd, 2021
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. game.Players.LocalPlayer.Chatted:Connect(function(msg)
  2. local cmd = msg:split(" ") -- split the word
  3. local prefix = "!" -- change your prefix here
  4. local afterprefix = "giveitem" -- name to call
  5. local Tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool") -- Find tool
  6.  
  7. if cmd[1] == prefix..afterprefix and cmd[2] and Tool then -- check cmd , check is player is vaild and is player equipped tool
  8. local Found = {} -- List of player char
  9.  
  10. for i,v in pairs(game.Players:GetPlayers()) do
  11. local name
  12. if cmd[3] == "true" then
  13. name = v.DisplayName
  14. else
  15. name = v.Name
  16. end
  17. if v ~= game.Players.LocalPlayer and cmd[2]:lower():sub(1,#name) == name:lower():sub(1,#name) then -- Confirm if name is 100% correct
  18. table.insert(Found,v.Character) -- insert player char
  19. break
  20. elseif v ~= game.Players.LocalPlayer and cmd[2]:lower():sub(1,#cmd[2]) == name:lower():sub(1,#cmd[2]) then
  21. table.insert(Found,v.Character)
  22. end
  23. end
  24.  
  25. if #Found > 1 or #Found < 1 then -- Check if too many player cause sometime it maybe give wrong person
  26. return print("Error : Found too many players")
  27. end
  28.  
  29. spawn(function()
  30. repeat
  31. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = Found[1].HumanoidRootPart.CFrame -- goto player
  32. wait()
  33. until Tool.Parent ~= game.Players.LocalPlayer.Character -- Loop tp and stop when player is grab tool
  34. end)
  35. wait(.25)
  36. game.Players.LocalPlayer.Character.Humanoid:Destroy() -- delete your humanoid, i dont know why delete humanoid make other player can grab your equipped tool
  37. end
  38. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement