So I am trying to make it that when you say, "appat" and then a players name, it teleports you them. However, I keep getting this stupid error:
https://gyazo.com/2733f0c0e2aca93b2c6b59918cfdf3be
Here is the code:
game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) local lower = string.lower(msg) -- turns the letters inside the string to lowercase if string.match(lower,"appat ") then local sub = string.sub(msg,6,100) print(sub.. "EXEISITIST") dude = game.Players:FindFirstChild(sub).Name local animation = game.Players:FindFirstChild(sub).Character.Humanoid:LoadAnimation(game.Players:FindFirstChild(sub).Backpack.flight) animation:Play()
thats just a snippet of it
does anyone know how to fix this or why it's happening?
I believe the issue is that you are including the space (sixth character) when you chop your "lower" string on line 6. Because of that, you are seeking a player not named "zValerian", but "_zValerian".
An easy fix: Make your six into a seven (local sub = string.sub(msg,6,#lower))