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

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

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

✓ Accepted answer

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.

4 comments

0

Oh. Well anyways, thx!

1

I'd assume you'd get 'userdata expected, got string', like BlueTaslem. Maybe ROBLOX programmed in a useless overload for FindFirstChild?

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

1

It says, "Expected ':' not '.' calling member function FindFirstChild"

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