DevUndead
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 558 |
|
|
| 01 Aug 2014 09:11 PM |
how would I create a handler that took all the players, and any models named trap, and if a player stepped on a trap it would take that players health, minus the trap that the players step on damage value(which is in a configuration inside the mode) number value. This is what I had but etheir I'm a idiot or only a god can do this.
gFunctions = _G[script.Name]
for i,v in pairs(Workspace.Traps:GetChildren()) do v.Touched:connect(function(part) if part.Parent:FindFirstChild("Humanoid") and v.Config.trapDuribility then part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - v.Config.Damage.Value v.Config.trapDuribility = v.Config.trapDuribility - 1 end end) end
gFunctions.ready = true |
|
|
| Report Abuse |
|
|
DevUndead
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 558 |
|
| |
|
|
| 01 Aug 2014 10:13 PM |
Mudkip, go! The bump has fainted. |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2014 10:13 PM |
"and v.Config.trapDuribility then" What about the trapDuribility? Do you mean > 0? Do you mean :FindFirstChild("trapDuribility")?
Also, it's 'durability' but you spelled it wrong each time so that's fine. |
|
|
| Report Abuse |
|
|
Stefan631
|
  |
| Joined: 23 Dec 2010 |
| Total Posts: 1350 |
|
|
| 01 Aug 2014 10:14 PM |
Troll use spam!
it was berry effective |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2014 10:22 PM |
| Are we really playing a forum-ish pokemon lol |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
| |
|
DevUndead
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 558 |
|
|
| 01 Aug 2014 10:30 PM |
A wild bump appears, and uses playerTrap Handler Algorithm!
gFunctions = _G[script.Name]
for i,v in pairs(Workspace.Traps:GetChildren()) do v.Touched:connect(function(part) if part.Parent:FindFirstChild("Humanoid") and v.Config.trapDuribility.Value > 0 then part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - v.Config.Damage.Value v.Config.trapDuribility = v.Config.trapDuribility - 1 end end) end
gFunctions.ready = true
It's super effective.
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2014 10:39 PM |
In roblux calling...
local a = true print(a) -- true
local ni = nil print(ni) -- false
local ni1 = Workspace print(ni1) -- true
We check in lua if something is true or false. If we check for nil (by just stating the instance) then it will either give you true or false. Since you pointed to the instance and not the value of it, then you were equivilating it to that. |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 01 Aug 2014 10:55 PM |
| pretty sure "ni1=workspace" would return userdata |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 01 Aug 2014 11:06 PM |
'local ni = nil print(ni) -- false
local ni1 = Workspace print(ni1) -- true'
Uh, nil is not equal to false and Workspace is not equal to true. nil is equal to nil and Workspace is equal to DataModel.Workspace |
|
|
| Report Abuse |
|
|
DevUndead
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 558 |
|
|
| 01 Aug 2014 11:14 PM |
| Forumers use confusion, scripter fainted.. |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2014 12:48 PM |
At a quick first glance, I don't see any errors.
Do you have any output? Are traps a model, or a part?
and v.Config.trapDuribility is that a bool? If so, make it check
and v.Config.trapDuribility.Value |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2014 12:49 PM |
| ^ Nvm what I said above about trapdurability. Didn't see you fixed it in a later post. |
|
|
| Report Abuse |
|
|