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

Can you help me? [closed]

Asked by 10 years ago

Help! I want to make a script that when you type a player name in the gui that player will recive the item you are holding but i don't know how, thanks.

Closed as Not Constructive by evaera

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
botor2 0
10 years ago

I think this is what you're looking for:

NameGui = --Put the path to the GUI containing the player's name that is being typed (For example, script.Parent.Parent.TextBox)
PlayerGui = script --Put .Parent's here until you reach the PlayerGui, which would be the StarterGui in studio.

function Give()
    Players = game.Players:GetChildren()
    for i = 1,#Players do
        wait()
        if Players[i].Name == NameGui.Text then
            PotentialTools = PlayerGui.Parent.Character:GetChildren()
            for i = 1,#PotentialTools do
                wait()
                if PotentialTools[i].ClassName == "Tool" or PotentialTools[i].ClassName == "HopperBin" then
                    PotentialTools[i].Parent = game.Players:FindFirstChild(NameGui.Text).Backpack
                    -- PotentialTools[i].Parent = game.Players:FindFirstChild(NameGui.Text).StarterGear
-- Remove the two dash's from the line above if you want the player to get that item every time they spawn.
                end
            end
        end
    end
end

script.Parent.MouseButton1Click:connect(Give)

You'd want to put that in the button the player would be clicking.

It should work, but I haven't tried it, or anything like it.

Ad