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
 

Re: Don't mind this unless you want to

Previous Thread :: Next Thread 
DevUndead is not online. 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 is not online. DevUndead
Joined: 24 Jul 2014
Total Posts: 558
01 Aug 2014 10:03 PM
A wild bump appears
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
01 Aug 2014 10:13 PM
Mudkip, go!
The bump has fainted.
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
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 is not online. Stefan631
Joined: 23 Dec 2010
Total Posts: 1350
01 Aug 2014 10:14 PM
Troll use spam!

it was berry effective
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
01 Aug 2014 10:22 PM
Are we really playing a forum-ish pokemon lol
Report Abuse
robotmega is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
01 Aug 2014 10:22 PM
trapDuribility.Value*
Report Abuse
DevUndead is not online. 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
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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 is not online. robotmega
Joined: 16 May 2009
Total Posts: 14084
01 Aug 2014 10:55 PM
pretty sure "ni1=workspace" would return userdata
Report Abuse
cntkillme is not online. 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 is not online. DevUndead
Joined: 24 Jul 2014
Total Posts: 558
01 Aug 2014 11:14 PM
Forumers use confusion, scripter fainted..
Report Abuse
Sethalonian is not online. Sethalonian
Joined: 13 Jan 2010
Total Posts: 530
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
Sethalonian is not online. Sethalonian
Joined: 13 Jan 2010
Total Posts: 530
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
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