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

How can I fix this error? wajidwjaidjwadjiwajdowajdo

Asked by 7 years ago
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

Log in to vote
0
Answered by 7 years ago

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

0
More appropriate as comment then answer Thundermaker300 554 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

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

Answer this question