generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Chat Check-> kick

Previous Thread :: Next Thread 
Joseph96gr is not online. Joseph96gr
Joined: 28 Aug 2012
Total Posts: 383
08 Jan 2013 02:09 AM
this is supposed to run a message that makes the players chat the requested word and those who dont are kicked from the game (not being mean to the safe chatters, i know they make perfect punching bags for my game but if they cant chat to script build, then they're in the way of those who can):



unsafePlayers = { }
players = Game.Players:GetChildren()

while wait(10) do -- This is how often it occurs

for pl = 1, #players do
table.insert(unsafePlayers, tostring(players[pl].Name))
end

local msg = Instance.new("Message", Workspace)
msg.Text = "Please say \"script\" to continue without being kicked"
wait (5)
msg.Text = "10 seconds to respond"
wait (1)
msg.Text = "9"
wait (1)
msg.Text = "8"
wait (1)
msg.Text = "7"
wait (1)
msg.Text = "6"
wait (1)
msg.Text = "5"
wait (1)
msg.Text = "4"
wait (1)
msg.Text = "3"
wait (1)
msg.Text = "2"
wait (1)
msg.Text = "1"
wait (1)
msg.Text = "0"
wait (1)
msg:Destroy()


for p = 1, #players do
players[p].Chatted:connect(function(chat)
if chat:lower() == "script" then
table.remove(unsafePlayers, tostring(players[p].Name))
end
end)
end

wait(10) -- How long they have to respond
for i,v in ipairs(unsafePlayers) do
if Game.Players:findFirstChild(v) then
Game.Players[v]:Destroy()
end
end

unsafePlayers = { }
msg:Destroy()

end
Report Abuse
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
08 Jan 2013 02:16 AM
game.Players.PlayerAdded:connect(function(plr)
local isSafe = false
coroutine.resume(coroutine.create(function()
local msg = Instance.new("Message", plr.PlayerGui)
for i = 10,0 do
if not isSafe then
msg.Text = [=[Please say "script\" to continue without being kicked. You have ]=]..i..[=[seconds left to respond.]=]
wait(1)
else
return
end
end))
plr.Chatted:connect(function(msg)
if msg:lower() == "script/" then
isSafe = true
end
end)
end)
Report Abuse
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
08 Jan 2013 02:18 AM
Whoops:

local isSafe = false
coroutine.resume(coroutine.create(function()
local msg = Instance.new("Message", plr.PlayerGui)
for i = 10,0 do
if not isSafe then
msg.Text = [=[Please say "script\" to continue without being kicked. You have ]=]..i..[=[seconds left to respond.]=]
wait(1)
else
return
end
if not isSafe then
plr:Destroy()
end
end))
plr.Chatted:connect(function(msg)
if msg:lower() == "script/" then
isSafe = true
end
end)
end)
Report Abuse
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
08 Jan 2013 02:21 AM
Don't use that... Wait a few secs. I'll make one.
Report Abuse
IamAwesome777 is not online. IamAwesome777
Joined: 18 Jul 2011
Total Posts: 2640
08 Jan 2013 02:23 AM
lol idk why that doesn't want to work.
Report Abuse
Joseph96gr is not online. Joseph96gr
Joined: 28 Aug 2012
Total Posts: 383
08 Jan 2013 02:24 AM
i got dis, i had a little help no less, dont forget the last thread i had with the similar case:



--Made by CodyTheBuildingKid, Modifyed by Joseph96gr--
--AntiSafeChatter certified--

Game.Players.PlayerAdded:connect(function(player)
repeat wait() until player.Character
wait(20)
local msg = Instance.new("Message", player.PlayerGui)
msg.Text = "Please say \"script\" to continue without being kicked"
wait(5)
msg.Text = "You have 15 seconds to respond before you are kicked"
wait(1)
msg.Text = "14"
wait(1)
msg.Text = "13"
wait(1)
msg.Text = "12"
wait(1)
msg.Text = "11"
wait(1)
msg.Text = "10"
wait(1)
msg.Text = "9"
wait(1)
msg.Text = "8"
wait(1)
msg.Text = "7"
wait(1)
msg.Text = "6"
wait(1)
msg.Text = "5"
wait(1)
msg.Text = "4"
wait(1)
msg.Text = "3"
wait(1)
msg.Text = "2"
wait(1)
msg.Text = "1"
wait(1)
msg.Text = "0"



player.Chatted:connect(function(chat)
safe = false
if chat:lower() == "script" then
safe = true
end
end)

wait(20)
if not safe then
msg.Text = "You have been removed from the game"
player:Destroy()
else
msg:Destroy()
end
end)
Report Abuse
doneyes is online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
08 Jan 2013 06:43 AM
You really should put in a for loop on the countdown.
Report Abuse
Joseph96gr is not online. Joseph96gr
Joined: 28 Aug 2012
Total Posts: 383
08 Jan 2013 03:51 PM
why loop? when the player enters, he is prompted by a message saying to chat the word "script" inorder to not be removed from the game. those deemed "safe" wont see it again, though i need to lengthen the time before script starts to process.
Report Abuse
doneyes is online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
08 Jan 2013 05:22 PM
You could easily for loop this:

msg.Text = "14"
wait(1)
msg.Text = "13"
wait(1)
msg.Text = "12"
wait(1)
msg.Text = "11"
wait(1)
msg.Text = "10"
wait(1)
msg.Text = "9"
wait(1)
msg.Text = "8"
wait(1)
msg.Text = "7"
wait(1)
msg.Text = "6"
wait(1)
msg.Text = "5"
wait(1)
msg.Text = "4"
wait(1)
msg.Text = "3"
wait(1)
msg.Text = "2"
wait(1)
msg.Text = "1"
wait(1)
msg.Text = "0"










count = 14

for i = 1,14 do
msg.Text = count
count = count -1
end


This sums that entire chunk into these few lines.
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
08 Jan 2013 05:31 PM
This
"count = 14

for i = 1,14 do
msg.Text = count
count = count -1
end"

Could be simplified more:


for i = 14, 1, -1 do
msg.Text = i
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image