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
 

One time use FF giver?

Previous Thread :: Next Thread 
Jro1311 is not online. Jro1311
Joined: 01 Jun 2013
Total Posts: 3328
14 Aug 2013 07:30 PM
So, I'm not really a good script. So how would you make this a one time use FF giver script?

local debounce = false
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil and debounce == false then
debounce = true
Field = Instance.new("ForceField")
Field.Parent = part.Parent
wait(0.1)
debounce = false
end
end

if (script.Parent ~= nil) and (script.Parent.className == "Part") then
connection = script.Parent.Touched:connect(onTouched)
end

*facepalm*facedesk*facewall*facefloor*facepop*facetree*facesand*facecake*
Report Abuse
Jro1311 is not online. Jro1311
Joined: 01 Jun 2013
Total Posts: 3328
14 Aug 2013 07:32 PM
Lol I mean scripter not script.

*facepalm*facedesk*facewall*facefloor*facepop*facetree*facesand*facecake*
Report Abuse
Jro1311 is not online. Jro1311
Joined: 01 Jun 2013
Total Posts: 3328
14 Aug 2013 07:37 PM
Any help? :/

*facepalm*facedesk*facewall*facefloor*facepop*facetree*facesand*facecake*
Report Abuse
Saviorofdragons is not online. Saviorofdragons
Joined: 10 Jan 2013
Total Posts: 489
14 Aug 2013 08:06 PM
That script just makes it to where it doesn't register the touched event more than once. So you only get one forcefield per touch, is what the script is doing. If you wanted to make it a one time use, you have the wrong script.
Report Abuse
Jro1311 is not online. Jro1311
Joined: 01 Jun 2013
Total Posts: 3328
14 Aug 2013 08:27 PM
I mean that if a player touched a brick and they got FF they can't get it another time unless they die.

*facepalm*facedesk*facewall*facefloor*facepop*facetree*facesand*facecake*
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
15 Aug 2013 01:42 AM
Make it insert something into the character along with the forcefield and add a check to see if it`s not there first. -Derp-
Report Abuse
Foxconn is not online. Foxconn
Joined: 20 Feb 2011
Total Posts: 275
15 Aug 2013 02:00 AM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil and h:findFirstChild("hax") == false then
local hax=Instance.new("Model", h.Parent)
hax.Name = "hax"
local ff = Instance.new("ForceField", h)
ff.Parent = part.Parent
wait(0.1)
elseif h~=nil and h:findFirstChild("hax") == true then return
end
end

if (script.Parent ~= nil) and (script.Parent.className == "Part") then
connection = script.Parent.Touched:connect(onTouched)
end

Maybe this will work...
Report Abuse
Foxconn is not online. Foxconn
Joined: 20 Feb 2011
Total Posts: 275
15 Aug 2013 02:02 AM
Oops. I didn't realize that h was humanoid. Replace my "h"s with "part.Parent"
Report Abuse
Foxconn is not online. Foxconn
Joined: 20 Feb 2011
Total Posts: 275
15 Aug 2013 02:03 AM
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil and part.Parent:findFirstChild("hax") == false then
local hax=Instance.new("Model", h.Parent)
hax.Name = "hax"
local ff = Instance.new("ForceField", part.Parent)
wait(0.1)
elseif h~=nil and part.Parent:findFirstChild("hax") == true then return
end
end

if (script.Parent ~= nil) and (script.Parent.className == "Part") then
connection = script.Parent.Touched:connect(onTouched)
end

There. This will work better
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