So I'm making a command bar, and for example, I have a kill command. The commands are seen from the textbutton.
My name is Player, and I have this text in the textbutton: kill player
What I want to do: -Check if there is a name "Player" in the game (with the text being 'player', not 'Player') -Kill the player if there is
What I've tried:
local textbox = script.Parent
local textbutton = script.Parent.ExecuteButton
local FindPlayer = function(plr)
local newplrs = game:GetService('Players'):GetPlayers()
for _,n in pairs(newplrs) do
if (string.lower(plr) == string.lower(n)) then
return true
end
end
end
Kill = function(text)
if (string.sub(text,1,5) == 'kill ') then
local trgPlayer = FindPlayer(string.sub(text,6))
if trgPlayer and trgPlayer.Character then
trgPlayer.Character:BreakJoints()
end
end
end
textbutton.MouseButton1Down:connect(function()
Kill()
end)
Any help would be appreciated.

2 comments
This code looks fine, except for the fact that you never give your Kill function an argument when you call it.
The code from 22-24 was just an example I made up in a few seconds, the actual code is way more complicated.