08-07-2011, 08:01 PM
(08-07-2011, 02:37 PM)Glome Wrote: Health pad:
[lua]enabled = true
local cooldown = 1 -- time until it reactivates
function waitFor(time)
local waittime = os.time()
while os.time() - waittime < time do
sleep(0.001)
end end
function OnCollided(hit)
if hit.Parent.Type == "Character" and enabled then
hit.Parent.Health = hit.Parent.MaximumHealth
script.Parent.Color = Color(255, 0, 0)
enabled = false
waitFor(cooldown)
script.Parent.Color = Color(0, 192, 0)
enabled = true
end
end
link(script.Parent.Collided, OnCollided)[/lua]
Deathplates:
[lua]enabled = true
local reappear = 5 --how many seconds until it becomes visible
function waitFor(time)
local waittime = os.time()
while os.time() - waittime < time do
sleep(0.001)
end end
function OnCollided(hit)
if hit.Parent.Type == "Character" and enabled then
enabled = false
script.Parent.Transparency = 0.2
waitFor(0.2)
script.Parent.Transparency = 0.4
waitFor(0.2)
script.Parent.Transparency = 0.6
waitFor(0.2)
script.Parent.Transparency = 0.8
waitFor(0.2)
script.Parent.Transparency = 1
script.Parent.Collidable = false
script.Parent.CharacterCollide = false
waitFor(reappear)
script.Parent.Transparency = 0
script.Parent.Collidable = true
script.Parent.CharacterCollide = true
enabled = true
end
end
link(script.Parent.Collided, OnCollided)[/lua]
Thanks so much! :> Dis will be epic fo mah place :>