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

What is the chat called in Lua?

Hi, I am making a script where if you say something it kicks you like :kick spider but for some reason I can't locate the correct chat name, Here is the script:

if LocalPlayer:Chat(":kick spider") then
game.Players.LocalPlayer:Destroy()

Can you tell me what the correct chat name is? Ty

4 comments

0

Is this the full script?

2

You make me cry.

0

Ty for insulting me, You totally deserve those reputation points :D

0

Check the edit in my answer.

1 answer

✓ Accepted answer

First of all, looks like you do not know what are events and if conditions. You cannot call a function between (if) and (then), also player has no function named (Chat), but you tried to call a function named (Chat). You can check Roblox Wiki for events, functions and properties. Here's a link . Some tips for what you wanted to do: You can use Player.Chatted event for an admin script thing, and you can use Player:Kick() for kick a player.

Edit: Then try to use this:

Player = game.Players.LocalPlayer
Player.Chatted:connect(function(msg)
	if string.sub(msg,1,5) == ":kick" then --You can change this to `msg == ":kick spider"` if u wish
		Player:Kick("Get out of my place u fake admin") --:Kick() is a function that can be used to kick players. If you type a text into  `()` you will make top red frame say whatever you type into it. 
	end
end)

3 comments

3

What? Of course you can call a function in an if statement, lol...

0

I am making it so when another player chats they will get kicked, This script is a example and of course not the full version but I can't make the full version until I can make it detect the string ":Kick spider" in chat

0

Link, yes you can, but function has to return a value. Forgot to add it, sorry. I rep u <3

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