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
Do not post spam like "dsaidshaiu" or "wdasuidashu"
This is because there is no text in the text box. When defining the variables, put them in the MouseButton1Down event.