Help with splitting a string

Hi there, I’m Aqveria but that’s not why you are here.

I know how to script but I need help with commands, here’s what I know so far…

game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)

But I want to split the message into 3 parts: ;promote - Start Aqveria - Middle Cashier - Last

I hope you can understand what I’m trying to say. Thank you for the help. <3

msg:split(" - ")

This will return a table { ";promote", "Start Aqveria", "Middle Cashier", "Last" }.

1 Like

So I could do

local target = game.Players:FindFirstChild(*second row*)
Target:Kick("lol")

?? Sorry, I’m not the best at this. I usually stick with user interface, could you help me by telling me how to cycle through a table?

Something like

local args = msg:split(" - ")
local target = Players:FindFirstChild(args[2])

if target then
    target:Kick()
end

Yes

2 Likes

Thanks so much <3 This helped me so much.