So basically what this code does is when the player says !nosnow it turns off the snow. How would I make it so !nosnow and !snow only turn the snow on/off for the player who said it and not the entire server?

function onChatted(msg, speaker)
	local source = string.lower(speaker.Name)
	msg = string.lower(msg)
	if msg == "!nosnow" then
		game.Workspace.Snow.Snow1.ParticleEmitter.Enabled = false
		game.Workspace.Snow.Snow2.ParticleEmitter.Enabled = false
	elseif msg == "!snow" then
		game.Workspace.Snow.Snow1.ParticleEmitter.Enabled = true
		game.Workspace.Snow.Snow2.ParticleEmitter.Enabled = true
	end
end
		
game.Players.PlayerAdded:connect(function(player)
	player.Chatted:connect(function(msg) onChatted(msg, player) end)
end)		

4 comments

0

use remote events and fire it with FireClient I believe

0

So when it's fired, would I make it so a local script picks up the event?

0

yes

0

I did it but it's not working.