|
| 13 Aug 2015 12:37 PM |
| Well. I've only learned the basics. But it seems some of the roblox wiki script help is a little outdated.... I've even copy and pasted a kill script from the wiki and it didn't work... So where else am i suppose to learn? ಠ_ಠ |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:38 PM |
A kill script is easy game.Players.LocalPlayer:TakeDamage(50) |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:39 PM |
Sorry I meant game.Players.LocalPlayer.Character.Humanoid:TakeDamage(90) |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:40 PM |
| @zarman3402 No no no, its much more than that. I was making a Touched function script, but, I was trying to debounce it threw the wikis. And mine just wasn't working. So i copy and pasted their script they provided and it didn't work. |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:46 PM |
| Eh, anyone? No? Ok. I'll just continue learning threw the wikis... |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 13 Aug 2015 12:46 PM |
trust me, the wiki isn't outdated.
can you show us your script? |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:47 PM |
I started here after watching a few videos http://www.roblox.com/Forum/ShowPost.aspx?PostID=153548676 check that link out. |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:52 PM |
@ instawin Yeah sure. I understand what debounce does but I'm having trouble learning how to debounce.
Here is the script i attempted to make:
De = script.Disabled
local De = true
function kill() if De == true then De = false wait(1) end h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then h.Health = h.Health - 5 wait(5) De = true end end
script.Parent.Touched:connect(kill)
And here is the script roblox wiki provided:
local buttonPressed = false
script.Parent.Touched:connect(function(hit) if not buttonPressed then
buttonPressed = true
if hit.Parent then hum = hit.Parent:FindFirstChild("Humanoid") hum.Health = hum.Health - 5 end wait(3) buttonPressed = false
end end) |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:54 PM |
| Better to use the TakeDamage method instead of subtracting it |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:55 PM |
| And it never looked like you called your function |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 13 Aug 2015 12:56 PM |
local enabled = true local downTime = 5
script.Parent.Touched:connect(function(hit) local hum = hit.Parent:FindFirstChild("Humanoid") if enabled and hum and hum.Health > 0 then enabled = false hum:TakeDamage(hum.MaxHealth) wait(downTime) enabled = true end end)
try that? |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 12:59 PM |
| @instawin, Yeah that surely killed me. |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 13 Aug 2015 01:00 PM |
yes, but notice, you'd have to wait 5 seconds again in order for the enabled variable to be true again (the amount of time it usually takes a standard character to respawn)
try it with 2 players. |
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 01:00 PM |
| Anonymous functions are easier for the mind to read. 27, have you called the function by simply typing your functions name with the parenthesis? |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 13 Aug 2015 01:01 PM |
| zarman, his function was being called. he connected it to the .Touched event, which would call his function every time .Touched was fired. |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 13 Aug 2015 01:05 PM |
De = script.Disabled
local De = true
function kill() if De == true then De = false wait(1) end h = hit.Parent:FindFirstChild("Humanoid") if h ~= nil then h.Health = h.Health - 5 wait(5) De = true end end
script.Parent.Touched:connect(kill)
first thing that is wrong here,
hit is never defined (you forgot to add it as your function's parameter
and you didn't set up your debounce correctly.the function should check if De is already true, and if it isn't, don't execute the rest of the function. if it already true, set it to false so the function wouldn't execute multiple times, kill the humanoid, wait for how long you want the debounce to last, and set De back to true.
|
|
|
| Report Abuse |
|
|
|
| 13 Aug 2015 01:07 PM |
| @instawin k, Thanks for the criticism. |
|
|
| Report Abuse |
|
|
| |
|