Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

onChatted scripting Help?

function onPlayerChatted(player, message)
	if message == "Computer" or "Anyone here?" then
		local hint = Instance.new("Hint")
		hint.Parent = player
		hint.Text = "Yes?"
		wait(3)
		hint.Parent = nil
	end
end

function onPlayerChatted(player, message)
	if message == "Hello Computer" or "Hello?" or "" then
		local hint = Instance.new("Hint")
		hint.Parent = player
		hint.Text = "Hello Sir."
		wait(3)
		hint.Parent = nil
	end
end

function onPlayerEntered(player)
	wait(1) --delay for loading time
	player.Chatted:connect(function (message) onPlayerChatted(player, message) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)

1 answer

✓ Accepted answer

First of all, both functions shouldn't be called the same, causes confusion and may break the script, second of all game.Players.ChildAdded:connect( -- The name of the funciton you wrote, if you're going to make two funcitons then you must repeat Players.ChildAdded:connect( -- The other name.

There thats all I could spot

Also it should be

game.Players.LocalPlayer.Chatted:connect( - the function

1 comment

0

Still dont work

This discussion is preserved as it was. New answers, comments, and votes are closed.