Why is this not working?

I am trying to make it when the player says print hello it prints hello but it isn’t working.
Code:

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		local message = msg:lower()
		if message == "print hello" then
			print("hello")
		end
	end)
end)

I didn’t find any problem with your code, and when I tried your code it worked fine
print

It isn’t working in my game? But thanks for letting me know!

Where did you put your code? in Script or LocalScript?

It’s in a local script I could try making it in a script

No wonder it doesn’t work, PlayerAdded doesn’t work in LocalScript

2 Likes

Alright it works now, thanks :slight_smile:

make sure that it is a serverscript and its in serverscriptservice

1 Like