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

How can I fix this error? wajidwjaidjwadjiwajdowajdo

local room = script.Parent.Background.Room.Text
local name = script.Parent.Background.Name.Text
local key = script.Parent.KeyName.Value

script.Parent.Background.GiveKey.MouseButton1Down:connect(function()
	print "1"
	local newkey = game.StarterPlayer[key]:Clone()
	newkey.Room.Value = room
	local plr = game.Workspace[name]
	newkey.Parent = plr
end)

Error: 11:31:43.577 - Players.joshmatt1245.PlayerGui.RoomManager.Script:9: bad argument #2 to '?' (string expected, got nil)

11:31:43.577 - Stack Begin

11:31:43.578 - Script 'Players.joshmatt1245.PlayerGui.RoomManager.Script', Line 9

11:31:43.578 - Stack End

This is the error I get when I press on the "GiveKey" button.

wapjkmdwajdawoipdjiawjdoijodjjawjdaoiwjiodjawoidjawjdoiajwoidjioawjdoiawjoidjwaiojdawjidjawod

2 answers

Do not post spam like "dsaidshaiu" or "wdasuidashu"

1 comment

0

More appropriate as comment then answer

This is because there is no text in the text box. When defining the variables, put them in the MouseButton1Down event.

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