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

Argument 1 missing or nil? Trying to make a hotel key giver script.. Please help?

Asked by
4D_X 118
8 years ago
Edited by shayner32 8 years ago
script.Parent.MouseButton1Down:connect(function()
    p = game.Players:FindFirstChild(script.Parent.Parent.Name.Text)
    for i,v in pairs(game.Players:GetPlayers()) do
        c = v.Backpack:FindFirstChild('Room'..script.Parent.Parent.RoomNum.Text)
        if c then
            script.Parent.Text = "Room Taken!"
            script.Parent.TextColor3 = Color3.new(255,0,0)
            wait(3)
            script.Parent.Text = "Give Player Room Key (Must Be Full Name)"
            script.Parent.TextColor3 = Color3.new(0,255,0)
        else
            key = game.ServerStorage.Room101:Clone()
            key.Name = "Room"..script.Parent.Parent.RoomNum.Text
            key.Parent = p.Backpack
        end
    end
end)

Moderator note: Please use Lua code blocks for lua code, and format your code before posting.

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

On Line 2

  p = game.Players:FindFirstChild(script.Parent.Parent.Name.Text)

Change this from that to this

  p = game.Players:FindFirstChild(script.Parent.Parent.TargetName.Text)

Likewise change the Textbox from Name to TargetName.. your having a Naming conventions issue.

Its actually getting the name of the Frame... not the text box.

Ad

Answer this question