Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.