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: Invincibility Script Help (NEW MAY NEED CLARIFICATION)

Previous Thread :: Next Thread 
TheGoldenDusekkar is not online. TheGoldenDusekkar
Joined: 29 Sep 2010
Total Posts: 93
13 Aug 2014 05:59 PM
Currently I am trying to make a script that, when the server starts, there are 9 minutes and 40 seconds of invincibility. After those 9 minutes and 40 seconds there are 5 minutes of vulnerability where players are able to take damage from weapons again. Then the script repeats itself so that the players are invincible for 9 minutes and 40 seconds again, and so on.

This is what I have so far:

local waittime=1--in minutes
local t=Instance.new("IntValue", Workspace)
t.Value=waittime*60;
function initialize();
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
local isActive=t.Value > 0
if isActive then
wait(0.5)
c:WaitForChild("Humanoid").MaxHealth=math.huge;
print(c.Humanoid.MaxHealth)
end
end)
end)


t.Changed:connect(function()
if t.Value < 2 then
print'less than two doe'
for _, v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Character and v.Character.Humanoid then
v.Character.Humanoid.MaxHealth=100;
end
end
end
end)



for i=t.Value, 1, -1 do
t.Value=i;
wait(1)
end

end

while true do
initialize()
wait(waittime*60)
end

There is an error near the beginning of the script that I need help fixing and I also need help incorporating the time limits into the script. Just for some help, there are 300 seconds in 5 minutes and 580 seconds in 9 minutes and 40 seconds.
Report Abuse
TheGoldenDusekkar is not online. TheGoldenDusekkar
Joined: 29 Sep 2010
Total Posts: 93
13 Aug 2014 07:45 PM
BUMP!
Report Abuse
TheGoldenDusekkar is not online. TheGoldenDusekkar
Joined: 29 Sep 2010
Total Posts: 93
13 Aug 2014 08:34 PM
Bump..
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 08:41 PM
here

-.-


local waittime=1--in minutes
local vulnerbilitytime=1--in minutes
local t=Instance.new("IntValue", Workspace)
t.Value=waittime*60;
function initialize();
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
local isActive=t.Value > 0
if isActive then
wait(0.5)
c:WaitForChild("Humanoid").MaxHealth=math.huge;
print(c.Humanoid.MaxHealth)
end
end)
end)


t.Changed:connect(function()
if t.Value < 2 then
print'less than two doe'
for _, v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Character and v.Character.Humanoid then
v.Character.Humanoid.MaxHealth=100;
end
end
end
end)



for i=t.Value, 1, -1 do
t.Value=i;
wait(1)
end
end

while true do
initialize()
wait(vulnerbilitytime*60)
end
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
13 Aug 2014 08:42 PM
And there is a small syntax error that was there


local waittime=1--in minutes
local vulnerbilitytime=1--in minutes
local t=Instance.new("IntValue", Workspace)
t.Value=waittime*60;
function initialize()
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
local isActive=t.Value > 0
if isActive then
wait(0.5)
c:WaitForChild("Humanoid").MaxHealth=math.huge;
print(c.Humanoid.MaxHealth)
end
end)
end)


t.Changed:connect(function()
if t.Value < 2 then
print'less than two doe'
for _, v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Character and v.Character.Humanoid then
v.Character.Humanoid.MaxHealth=100;
end
end
end
end)



for i=t.Value, 1, -1 do
t.Value=i;
wait(1)
end
end

while true do
initialize()
wait(vulnerbilitytime*60)
end
Report Abuse
TheGoldenDusekkar is not online. TheGoldenDusekkar
Joined: 29 Sep 2010
Total Posts: 93
13 Aug 2014 09:03 PM
Thanks a ton and it works pretty well except upon death, in vulnerability mode, people gain invincibility again. Any knowledge why?
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