Hello! Please bear with me as I’m pretty new to scripting and this is my first post
Basically, I’m trying to get everything after a certain index inside a table. For example, I have split a player’s message and I’m trying to get everything after message[4] and print it as a reason:
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(msg)
local message = string.split(message, " ")
if string.lower(message[1]) == 'i' and string.lower(message[2]) == 'like' and string.lower(message[3]) == 'cake' and string.lower(message[4]) == 'because' then
-- the unknown part that needs to print all indexes after [4]
end
The problem is, I have used the API, Google, YouTube yet there’s no answer (or at least I haven’t understood it) also the printing part’s there just to test it out, my main script will originally have to use these extracted indexes together and put them in a variable that can be used in a forced message function:
(game:GetService("Chat"):Chat(Instance, text, Color))
I’d appreciate any redirection that could help me solve this question.
NOTE: I won’t be able to test responses until tomorrow, therefore if I haven’t marked the solution/closed the topic it’s either that I haven’t had the chance to get on yet or haven’t checked the forum.