Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why this "Hand to" works if i give the item to me, but if i use to another player it doesn't work?

Asked by
caipira 29
7 years ago

this script is supposed to give a tool to another player when i put the name in a TextGui, but it just works if i put my name, what's wrong?

local playaa = game.Players.LocalPlayer

repeat wait() until playaa.Character

local open = true
local mouse = playaa:GetMouse()

function FullName(name)
    for _,v in pairs(game.Players:GetPlayers()) do
        if v.Name:lower():match(name:lower()) then
            return v.Name
        else
            return "Couldn't find player"
        end
    end
    return "nothing"
end

function IsWorker()
    if playaa:GetRankInGroup(3613404) > 0 then
        return true
    else
        return false
    end
end

if IsWorker() == true then
    script.Parent.Frame.Visible = true
end

script.Parent.Frame.PlaceButton.MouseButton1Down:connect(function()
    for _,v in pairs(playaa.Character:GetChildren()) do
        if v:IsA("Tool") and FullName(script.Parent.Frame.CustomerBox.Text) ~= "nothing" then
            local plr = game.Players:FindFirstChild(FullName(script.Parent.Frame.CustomerBox.Text))
            if plr then
                v.Parent = plr.Backpack
                pcall(
                    function()
                        local plrgui = Instance.new("ScreenGui", plr.PlayerGui)
                        local textlabel = script.TextLabel:Clone()
                        textlabel.Parent = plrgui
                        textlabel.Text = playaa.Name.." Gave You "..v.Name
                        spawn(
                            function()
                                local yut = textlabel
                                wait(6)
                                for i = 1, 10 do
                                    yut.TextTransparency = yut.TextTransparency + 0.1
                                    yut.TextStrokeTransparency = yut.TextStrokeTransparency + 0.1
                                    wait()
                                end
                            end
                        )
                    end
                )
            end
        end
    end
end)
0
Are you trying to make it so that a player can shorten names? UgOsMiLy 1074 — 7y
0
no caipira 29 — 7y

Answer this question