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

bad argument #2 to '?' (string expected, got userdata) What??

Asked by 10 years ago

I thought I made this script without any errors, but i got this error. And I dont know how to fix it.

script.Parent.Touched:connect(function(devil)
    plr = devil.Parent
    local w = Instance.new("Message", game.Players[plr].PlayerGui)
    w.Text = "Congratz! You have found the Doku Doku no Mi fruit!"
    local g = game.ReplicatedStorage.FindFirstChild("Doku Doku no Mi"):Clone()
    g.Parent = game.Players[plr].Backpack
end)

Script ^^^

1 answer

Log in to vote
2
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

You use .FindFirstChild, but FindFirstChild is a method -- that means you have to use :FindFirstChild.


That error is strange, I would expect something similar, but not that; besides, ROBLOX should have a separate error specifically for this. Odd.

0
Oh. Well anyways, thx! Operation_Meme 890 — 10y
1
I'd assume you'd get 'userdata expected, got string', like BlueTaslem. Maybe ROBLOX programmed in a useless overload for FindFirstChild? adark 5487 — 10y
0
I thought there was a specific error that said something like "You used .FindFirstChild instead of :FindFirstChild", not sure where that went in this case BlueTaslem 18071 — 10y
1
It says, "Expected ':' not '.' calling member function FindFirstChild" EzraNehemiah_TF2 3552 — 10y
Ad

Answer this question