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 » Scripters
Home Search
 

Made a function that takes constant damage

Previous Thread :: Next Thread 
xlaser23 is not online. xlaser23
Joined: 10 Dec 2011
Total Posts: 20341
12 Mar 2016 08:14 AM
im not sure how i can stop it from doing it

i know i can use debounce but im calling it in a place with debounce used
the function is still going thour

function dmg()
local ab = char:FindFirstChild('Box')
if not ab then print "Weld not found to take Dmg" return end
ab.Touched:connect(function(hit)
if hit.Parent.Humanoid then
local hi = hit.Parent.Humanoid

hi.Health = hi.Health - 10



end
end)
end




http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$234 Tx314 (づ ゚ ³ ゚)づ
Report Abuse
os_time is not online. os_time
Joined: 15 Feb 2014
Total Posts: 2247
12 Mar 2016 08:15 AM
debounce in touched func


#code "Lua ~ PHP ~ CSS ~ HTML for me at least."
Report Abuse
hypur is not online. hypur
Joined: 22 May 2015
Total Posts: 17043
12 Mar 2016 08:21 AM
lawl


Report Abuse
xlaser23 is not online. xlaser23
Joined: 10 Dec 2011
Total Posts: 20341
12 Mar 2016 08:34 AM
even with debounce welded weapon still takes dmg

function dmg()
local ab = char:FindFirstChild('Box')
if not ab then print "Weld not found to take Dmg" return end

local no = false
if no == false then
ab.Touched:connect(function(hit)
no = true
if hit.Parent.Humanoid then
local hi = hit.Parent.Humanoid

hi.Health = hi.Health - 10


end
end)
wait(2)
no = false
end
end














local deb = false
Mouse.Button1Down:connect(function()
if deb == true then return end
deb = true
print '[1]'


local ww = char:FindFirstChild("weaponweld")
if not ww then print 'Weld Not found' return end
print '[3]'

if equip == true then
local humanoid = char.Humanoid
local id = "http://www.roblox.com/item.aspx?id=379808788"--Change the Id to want u want
local ani = Instance.new("Animation")

dmg()

print '[4]'

ani.AnimationId = id

local loadAnimation = humanoid:LoadAnimation(ani)
loadAnimation:Play()
print '[5]'

end
wait(2)
deb = false
end)



http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$234 Tx314 (づ ゚ ³ ゚)づ
Report Abuse
os_time is not online. os_time
Joined: 15 Feb 2014
Total Posts: 2247
12 Mar 2016 08:47 AM
function dmg()
local ab = char:FindFirstChild('Box')
if not ab then print "Weld not found to take Dmg" return end
ab.Touched:connect(function(hit)
if hit.Parent.Humanoid and not no then
no = true
local hi = hit.Parent.Humanoid
hi.Health = hi.Health - 10
wait(2)
no = nil
end
end)
end
end

Something like that typing on mobile is a pain


#code "Lua ~ PHP ~ CSS ~ HTML for me at least."
Report Abuse
Dev_Ryan is online. Dev_Ryan
Joined: 10 Mar 2013
Total Posts: 243
12 Mar 2016 08:48 AM
The debounce needs to be inside the connection.

Here is what I mean:

function dmg()
local ab = char:FindFirstChild('Box')
local debounce = false
if not ab then print "Weld not found to take Dmg" return end
ab.Touched:connect(function(hit)
if hit.Parent.Humanoid and not debounce then
debounce = true
local hi = hit.Parent.Humanoid
hi.Health = hi.Health - 10
wait(1)
debounce = false
end
end)
end
Report Abuse
xlaser23 is not online. xlaser23
Joined: 10 Dec 2011
Total Posts: 20341
12 Mar 2016 10:30 AM
alright thxs for the help



http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$234 Tx314 (づ ゚ ³ ゚)づ
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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