So what I want to get is the players name from a string such as string.sub I've tried 3 different ways to get the player but seemed to fail. Here is what I tried:
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local sub = string.sub(msg, 1,5)
if sub == ":kill" then
local player = string.sub(msg, 6)
local findplayer = game.Players:FindFirstChild(player)
if findplayer then
findplayer.Character:BreakJoints()
end
end
end)
end)
There is no error in output, and I've looked at the script many times but couldn't seem to find the problem.

2 comments
I've tried WaitForChild() as well
what about whitespaces?