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: Kill limitations

Previous Thread :: Next Thread 
squirrelterritory is not online. squirrelterritory
Joined: 17 Sep 2011
Total Posts: 276
15 Oct 2012 12:13 AM
I want to make it so if you die a more than twice in 30 seconds you get kicked from the game, (im not sure if you can kick someone from a game so if you can't i still need the script)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Oct 2012 12:14 AM
It's possible, its gonna be a longish script though
Report Abuse
Aerideyn is not online. Aerideyn
Joined: 16 Jan 2010
Total Posts: 1882
15 Oct 2012 12:38 AM
It's pretty easy to kick someone from a game, just remove their player object.

Other than that, connect to humanoid.Died in a local script and insert an int value into a model in workspace, save the DistributedGameTime into it and name the int value after the player.

then every time a player dies, just check if there is already a value there named after them from within the last 30 seconds.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Oct 2012 01:02 AM
Use like a while true and some tables
Report Abuse
squirrelterritory is not online. squirrelterritory
Joined: 17 Sep 2011
Total Posts: 276
15 Oct 2012 01:07 AM
Im relatively new to taking on more complex tasks like this and i dont even know how to write it out. and all i need the code for is to fix a bug where every time players reset they get to send out a message. so i want to make it so they dont do it twice.
Report Abuse
squirrelterritory is not online. squirrelterritory
Joined: 17 Sep 2011
Total Posts: 276
15 Oct 2012 01:09 AM
If you could elaborate a simple ban script i could figure out the rest from there
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Oct 2012 01:13 AM
local Banned = {}

function BanPlayer(PlayerName)
if game.Players:FindFirstChild(PlayerName) ~= nil then
table.insert(Banned, PlayerName)
game.Players:FindFirstChild(PlayerName):Destroy()
end
end
game.Players.ChildAdded:connect(function(Player)
for i,v in pairs(Banned) do
if v == Player.Name then
Player:Destroy()
end
end
end)
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
15 Oct 2012 10:01 AM
local PlayerS = {}

game.Players.PlayerAdded:connect(function(p)
PlayerS[p.Name] = {0, {0, 0}}
p.CharacterAdded:connect(function(c) wait()
c.Humanoid.Died:connect(function()
PlayerS[p.Name][1] = PlayerS[p.Name][1] + 1
if PlayerS[p.Name][1] > 1 then
if PlayerS[p.Name][2][1] < tick()-30 then
table.remove(PlayerS[p.Name][2], 1)
table.insert(PlayerS[p.Name][2], tick())
if PlayerS[p.Name][2][1] < tick()-30
table.remove(PlayerS[p.Name][2], 1)
table.insert(PlayerS[p.Name][2], tick())
else
p:Remove()
end
else
p:Remove()
end
end
end)
end)
end)
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
15 Oct 2012 01:37 PM
game:GetService("Players").PlayerAdded:connect(function(p)
Delay(.5,function()p:LoadCharacter()end)
local last_death=0
p.CharacterAdded:connect(function(c)
c:FindFirstChild("Humanoid").Died:connect(function()
if last_death~=0 and tick()-last_death>=30 then
p:Destroy()
else
last_death=tick()
end
end)
end)
end)
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
15 Oct 2012 03:19 PM
That wouldn't work.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
15 Oct 2012 03:48 PM
PreviousDeath = 0

game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Char)
Char.Humanoid.Died:connect(function()

if PreviousDeath == 0 then

for i = 30, 0, -1 do
PreviousDeath = i
wait(1)
end

elseif PreviousDeath > 0 then
Player:Destroy()

end end) end) end)


-------------------------
~thedestroyer115, http://www.roblox.com/String-Word-Randomizer-item?id=94754887~
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
15 Oct 2012 03:49 PM
Mine works. It's simple. OP use mine. kthx

-------------------------
~thedestroyer115, http://www.roblox.com/String-Word-Randomizer-item?id=94754887~
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
15 Oct 2012 03:50 PM
@destroyer

That wouldn't work for ALL players.
But I absolutely love how simple it is. The logic behind it is amazing. Kudos!
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
15 Oct 2012 03:51 PM
Thanks! That means a lot to me.

-------------------------
~thedestroyer115, http://www.roblox.com/String-Word-Randomizer-item?id=94754887~
Report Abuse
squirrelterritory is not online. squirrelterritory
Joined: 17 Sep 2011
Total Posts: 276
15 Oct 2012 05:20 PM
This chunk of code right here is what I was looking for i had an idea similar to this but the way i planned on writing probably was terribly wrong. Thank you

local PlayerS = {}

game.Players.PlayerAdded:connect(function(p)
PlayerS[p.Name] = {0, {0, 0}}
p.CharacterAdded:connect(function(c) wait()
c.Humanoid.Died:connect(function()
PlayerS[p.Name][1] = PlayerS[p.Name][1] + 1
if PlayerS[p.Name][1] > 1 then
if PlayerS[p.Name][2][1] < tick()-30 then
table.remove(PlayerS[p.Name][2], 1)
table.insert(PlayerS[p.Name][2], tick())
if PlayerS[p.Name][2][1] < tick()-30
table.remove(PlayerS[p.Name][2], 1)
table.insert(PlayerS[p.Name][2], tick())
else
p:Remove()
end
else
p:Remove()
end
end
end)
end)
end)
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
15 Oct 2012 05:30 PM
My version:

~ Local Script ~

local Player = game.Players.LocalPlayer
Player.Character.Humanoid.Died:connect(function()
if Player:findFirstChild("Kill Tag") then
Player:Remove()
else
local Tag = Instance.new("BoolValue", Player)
Tag.Name = "Kill Tag"
game.Debirs:AddItem(Tag, 30)
end
end)
Report Abuse
squirrelterritory is not online. squirrelterritory
Joined: 17 Sep 2011
Total Posts: 276
15 Oct 2012 05:38 PM
I f i put that in it will tell me then expected near "". i dont know where to put the then
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Oct 2012 05:57 PM
OnEntered,Add: Deaths (IntValue) toPlayer

OnDied:
Deaths.Value=Deaths.Value+1

--Loop [ScriptitWOrkspace]
While true and wait() do
for i,v in pairs(game.Players:GetChildren()) do
if v:FindFirstChild("Deaths") ~= nil then
if v["Deaths"].Value > 0 then
v:Destroy()
end
end
end
end
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
15 Oct 2012 06:57 PM
But.
I dun liek makin new valuez!
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
15 Oct 2012 06:59 PM
Why wouldn't mein work? :C

yu made me cry when yu said tht

its k im okk now

;c
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
15 Oct 2012 07:05 PM
The player would get kicked the second time they died if he died AFTER 30 seconds. :3
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
15 Oct 2012 07:07 PM
qq i cry now
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