Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Player = game.Players.LocalPlayer
- local HandToGui = script.Parent
- local NameBox = HandToGui.NameBox
- local GiveButton = HandToGui.NameBox
- local groupId = 5831373 -- change to your group
- local minimumRankToUseGui = 123 --change the number
- if Player:GetRankInGroup(groupId) < minimumRankToUseGui then
- HandtoGui:Destroy()
- end
- local function getPlayerFromPartialName(PartialName)
- local foundName = nil
- local Players = game.Players:GetPlayers()
- for i = 1, #Players do
- local PossiblePlayer = Players[i]
- if string.find(string.lower(PossiblePlayer.Name), string.lower(PartialName)) then
- foundName = PossiblePlayer.Name
- end
- end
- if not foundName then
- return nil
- else
- return foundName
- end
- end
- GiveButton.MouseButton1Click:Connect(function()
- if not Player.Character:FindFirstChildWhichIsA("Tool") then
- NameBox.Text = ""
- NameBox.PlaceholderText = "Equip a Tool First!"
- wait(1)
- NameBox.PlaceholderText = "Player Name Here"
- end
- local NameBoxText = NameBox.Text
- if NameBoxText ~= "" then
- local playerName = getPlayerFromPartialName(NameBoxText)
- if playerName then
- print("Found player")
- game.ReplicatedStorage.GivePlayerItem:FireServer(playerName)
- NameBox.Text = ""
- NameBox.PlaceholderText = "Gave!"
- wait(1)
- NameBox.PlaceholderText = "Player Name Here"
- else
- NameBox.Text = ""
- NameBox.PlaceholderText = "Player Not Found!"
- wait(1)
- NameBox.PlaceholderText = "Player Name Here"
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement