Whenever I use this in my work, it gets it as a nil value and whenever that happens it means I've done the concatenation wrong.

Example:

workspace:WaitForChild((Player.Name).."'s ".."Drink")

Tried this:

workspace:WaitForChild((Player.Name)..("'s ")..("Drink"))

What I'm trying to do:

if workspace:WaitForChild((Player.Name).."'s ".."Drink") then
--code
end

instead it gives me this error Attempt to index a nil value

I believe this is from me using ' before s to show who's drink it is but I could be wrong.

3 comments

0

Anything in between quotation marks is indicated as a string so that shouldn't affect the script. Try checking if you specified player with a lowercase p. Thats the only thing I can think of, sorry

0

Its to do with the player probably being a nil value. the strings are not the error

0

So it cant get localplayer's name?