Advertisement
Jays-Gaming_Sp0t

Give Tool Script

Aug 12th, 2020 (edited)
10,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer
  2. local HandToGui = script.Parent
  3. local NameBox = HandToGui.NameBox
  4. local GiveButton = HandToGui.NameBox
  5.  
  6. local groupId = 5831373 -- change to your group
  7. local minimumRankToUseGui = 123 --change the number
  8.  
  9. if Player:GetRankInGroup(groupId) < minimumRankToUseGui then
  10. HandtoGui:Destroy()
  11. end
  12.  
  13. local function getPlayerFromPartialName(PartialName)
  14. local foundName = nil
  15. local Players = game.Players:GetPlayers()
  16. for i = 1, #Players do
  17. local PossiblePlayer = Players[i]
  18. if string.find(string.lower(PossiblePlayer.Name), string.lower(PartialName)) then
  19. foundName = PossiblePlayer.Name
  20. end
  21. end
  22.  
  23. if not foundName then
  24. return nil
  25. else
  26. return foundName
  27. end
  28. end
  29. GiveButton.MouseButton1Click:Connect(function()
  30. if not Player.Character:FindFirstChildWhichIsA("Tool") then
  31. NameBox.Text = ""
  32. NameBox.PlaceholderText = "Equip a Tool First!"
  33. wait(1)
  34. NameBox.PlaceholderText = "Player Name Here"
  35. end
  36. local NameBoxText = NameBox.Text
  37. if NameBoxText ~= "" then
  38. local playerName = getPlayerFromPartialName(NameBoxText)
  39. if playerName then
  40. print("Found player")
  41. game.ReplicatedStorage.GivePlayerItem:FireServer(playerName)
  42. NameBox.Text = ""
  43. NameBox.PlaceholderText = "Gave!"
  44. wait(1)
  45. NameBox.PlaceholderText = "Player Name Here"
  46. else
  47. NameBox.Text = ""
  48. NameBox.PlaceholderText = "Player Not Found!"
  49. wait(1)
  50. NameBox.PlaceholderText = "Player Name Here"
  51. end
  52. end
  53. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement