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

5 comments

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.

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

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.

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

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.