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

[half solved] "unable to cast string to token"?

alright so i was following a basic tutorial on the roblox game lua learning, then noticed this was working for other players; this is supposed to make a character model/part be able to talk in chat, here it goes:

local phrases = {"Hi, I'm Catto!","I'm baby is my catchphrase!","Shoutout to my ROBLOX friendslist!!"}
local part = workspace.Cattoish
while wait (5) do
	local phrases = phrases[math.random(1,#phrases)]
	game:GetService("Chat"):Chat(part,"Hi, I'm Catto!","I'm baby is my catchphrase!","Shoutout to my ROBLOX friendslist!!",Enum.ChatColor.White)
end

so now, what are the problems causing it to show "unable to cast string to token"? is it my code? (also if the code is wrong let me know i'm kinda a noobie so i'm not sure)

thank you!!

1 comment

1

This isn't Lua learning customer service; we only help problems which occur on your code

1 answer

You can only pass 1 string through the arguments at a time.

local phrases = {"Hi, I'm Catto!","I'm baby is my catchphrase!","Shoutout to my ROBLOX friendslist!!"}
local part = workspace.Cattoish
while wait (5) do
    local phrases = phrases[math.random(1,#phrases)]
    game:GetService("Chat"):Chat(part,"Hi, I'm Catto!",Enum.ChatColor.White)
end

ChatService

This only takes 3 arguments, and you can only pass 3 arguments, not anymore than that.

Hope this helped! Feel free to select this as the answer if this helped you!

2 comments

0

hi, yes this did help though i'm having problems with it now showing "partorcharacter is not a legal character" and as again stated i'm kinda a noob and the parent of the script is my roblox character i imported with a plugin, does this have anything to do with that or is it the script (again)?

0

I'm not sure. This is also an XY question. You asked about problem X, and are looking for solution Y. Keep on track and post another question if you're getting different errors.

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