Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I've been trying to find out why the hell this isn't working did I miss something?

Asked by 5 years ago

I've created this command for an Admin Script I'm making it was working before but now it doesn't work and the only reason I haven't fixed it yet is that it isn't putting an error at all to tell me what's wrong and what's broken.

I've been trying to get it to work for ages now it doesn't output and error so that's not any help I'm not sure if lack of sleep has made me not able to see the thing wrong or what.

Here's the code:

        if PlayerMessage:sub(1, 9) == "/respawn " then
            local TargetPlayer = game.Players:FindFirstChild(PlayerMessage:sub(10))
            if TargetPlayer.Name == "Cryo_Dev" then

                    CommandFailed()

               else

            if TargetPlayer then

              TargetPlayer:LoadCharacter()
              CommandSuccess()

            else

                  CommandFailed()

                  end
              end
          end
0
FindFirstChild is case sensitive and you need to spell the entire name out. You probably only put half of your name or didn't capitalise it or something. User#24403 69 — 5y
0
I'll give it a try and watch all the text I type in see if it's just me being tired and typing too fast when testing it Cryo_Dev 9 — 5y
0
Just created a script that will find a player without their full name, and even without the correct capitalisation and such https://pastebin.com/qgxkzL1V. User#24403 69 — 5y
0
I'm not sure why i doesnt work tho I'm typing out the command the way its supposed to be like shown in the "/respawn " and then my name which is "Cryo_Dev" and yet the Chatted event is either not working or just isnt running that command because other commands work fine just this one isnt working Cryo_Dev 9 — 5y
0
And I dont really like copying other code not made by me because it'll look miss placed in the code as the others are written just like this one just this one doesnt want to work. Cryo_Dev 9 — 5y

Answer this question