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
 

Attack needs Cooldown, help ASAP!

Previous Thread :: Next Thread 
Warfelz is not online. Warfelz
Joined: 09 Jun 2013
Total Posts: 2
21 Jun 2013 07:53 AM
I have this attack and I tried adding wait(5) to the places I think will make it have a cooldown but it doesn't work. Also I'm not a great scripter so help is really appreciated. Thank you!

Here is the script:

if script.Parent.className ~= "HopperBin" then
local h = Instance.new("HopperBin")
h.Name = "wsd"
h.Parent = game.Players.ws.Backpack
script.Parent = h
end

function ClusterBombPiece(mis, tar, misg, misv)
while mis.Parent == Workspace and tar:IsDescendantOf(Workspace) do
wait()
misg.cframe = CFrame.new(tar.Position, mis.Position)
misv.velocity = mis.CFrame.lookVector * -250
end
end

bin = script.Parent
player = bin.Parent.Parent.Character
colors = {"Bright blue"}
function onClicked (mouse)
for i = 1,20 do
wait()
local bul = Instance.new("Part")
bul.formFactor = "Symmetric"
bul.Shape = "Ball"
bul.Size = Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))
local cr = math.random(1,#colors)
local color = colors[cr]
bul.BrickColor = BrickColor.new(color)
bul.Transparency = .5
bul.CanCollide = true
bul.TopSurface = 0
bul.BottomSurface = 0
bul.CFrame = player.Torso.CFrame * CFrame.new(0,0,-5)
bul.Parent = Workspace
local bulv = Instance.new("BodyVelocity")
bulv.maxForce = Vector3.new(math.huge,math.huge,math.huge)
bulv.velocity = CFrame.new(player.Torso.Position, mouse.Hit.p).lookVector * (200)
bulv.Parent = bul
bul.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if hit.Parent.Name ~= player.Name then
hit.Parent.Humanoid:TakeDamage(5)
bul:remove()
end
end
end)
game:GetService("Debris"):AddItem(bul, .7)
end
end

function onSelected (mouse)
mouse.Button1Down:connect(function() onClicked (mouse) end)
mouse.KeyDown:connect(function(key)
if key == "z" then
bin.Name = "Mud-slap"
elseif key == "x" then
bin.Name = "Take Down"
elseif key == "c" then
bin.Name = "Mud Sport"
elseif key == "v" then
bin.Name = "Water Gun"
end
end)
end

script.Parent.Selected:connect(onSelected)
Report Abuse
petro180 is not online. petro180
Joined: 30 Mar 2009
Total Posts: 354
21 Jun 2013 08:20 AM
cooldown = false --Add a Boolean.


if script.Parent.className ~= "HopperBin" then
local h = Instance.new("HopperBin")
h.Name = "wsd"
h.Parent = game.Players.ws.Backpack
script.Parent = h
end

function ClusterBombPiece(mis, tar, misg, misv)
while mis.Parent == Workspace and tar:IsDescendantOf(Workspace) do
wait()
misg.cframe = CFrame.new(tar.Position, mis.Position)
misv.velocity = mis.CFrame.lookVector * -250
end
end

bin = script.Parent
player = bin.Parent.Parent.Character
colors = {"Bright blue"}
function onClicked (mouse)
if cooldown = false then
cooldown = true
for i = 1,20 do
wait()
local bul = Instance.new("Part")
bul.formFactor = "Symmetric"
bul.Shape = "Ball"
bul.Size = Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))
local cr = math.random(1,#colors)
local color = colors[cr]
bul.BrickColor = BrickColor.new(color)
bul.Transparency = .5
bul.CanCollide = true
bul.TopSurface = 0
bul.BottomSurface = 0
bul.CFrame = player.Torso.CFrame * CFrame.new(0,0,-5)
bul.Parent = Workspace
local bulv = Instance.new("BodyVelocity")
bulv.maxForce = Vector3.new(math.huge,math.huge,math.huge)
bulv.velocity = CFrame.new(player.Torso.Position, mouse.Hit.p).lookVector * (200)
bulv.Parent = bul
bul.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if hit.Parent.Name ~= player.Name then
hit.Parent.Humanoid:TakeDamage(5)
bul:remove()
end
end
end)
game:GetService("Debris"):AddItem(bul, .7)
end
end
wait(5) --5 second wait time
cooldown = false --Cooldown is now false.
end

function onSelected (mouse)
mouse.Button1Down:connect(function() onClicked (mouse) end)
mouse.KeyDown:connect(function(key)
if key == "z" then
bin.Name = "Mud-slap"
elseif key == "x" then
bin.Name = "Take Down"
elseif key == "c" then
bin.Name = "Mud Sport"
elseif key == "v" then
bin.Name = "Water Gun"
end
end)
end

script.Parent.Selected:connect(onSelected)
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