This command hands the tool a player is holding to another player. You have to say :handto player. Can I make this work so that they don't have to type the full username. For example :handto ov instead of :handto ovyxn.
--//Local ROBLOX DataModel Instances
local Players = game:GetService("Players")
--//Local Model Instances
--nil
--//Local Variable Instances
local Group = 3992679
local MinimalRank = 3
--\\Start-Up
warn(script.Name..": ONLINE")
--//Functions
Players.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(Group) >= MinimalRank or plr.Name == "ovyxn" then
plr.Chatted:Connect(function(msg)
for _,players in pairs(Players:GetPlayers()) do
if msg == ":handto "..players.Name then
if plr.Character:FindFirstChildOfClass("Tool") then
plr.Character:FindFirstChildOfClass("Tool").Parent = players.Backpack
end
end
end
end)
end
end)

3 comments
You can iterate through each Players’ names within a Players:GetPlayers() array, and call the :sub() method to the length of the search string. A more unstable alternative is Player.Name:find(search)
I'm new to scripting. Could you tell me how to do that?
plz