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: What do I add?

Previous Thread :: Next Thread 
RobinsHssm is not online. RobinsHssm
Joined: 09 Nov 2011
Total Posts: 805
21 Oct 2013 09:52 PM
script.Parent.Touched:connect(function(hit) pcall(function() game.ServerStorage.LinkedSword:clone().Parent=game.Players:getPlayerFromCharacter(hit.Parent).Backpack end) end)

when you teleport to a tele brick in game I use this script and it gives the player a LinkedSword. However it gives you 5-10 swords. You fall through the brick and into the map but you receive more than one sword. What do I add so you only get one sword everytime you teleport?
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
21 Oct 2013 09:53 PM
debounce.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
21 Oct 2013 09:53 PM
check if it exists in the backpack using FindFirstChild
Report Abuse
RobinsHssm is not online. RobinsHssm
Joined: 09 Nov 2011
Total Posts: 805
21 Oct 2013 09:54 PM
so like this:


script.Parent.Touched:connect(function(hit) pcall(function()
(debounce)
game.ServerStorage.LinkedSword:clone().Parent=game.Players:getPlayerFromCharacter(hit.Parent).Backpack end) end)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
21 Oct 2013 09:55 PM
no.
You don't need a denounce, my method "provides" a denounce and won't let them be able to get more than 1
Report Abuse
RobinsHssm is not online. RobinsHssm
Joined: 09 Nov 2011
Total Posts: 805
21 Oct 2013 09:55 PM
I want to add the debounce though, how do I add it. What would it look like.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
21 Oct 2013 09:57 PM
blah=true
script.Parent.Touched:connect(function(hit) if not blah return end blah=false pcall(function()
(debounce)
game.ServerStorage.LinkedSword:clone().Parent=game.Players:getPlayerFromCharacter(hit.Parent).Backpack end) wait(1) blah=true end)
Report Abuse
Jayskull900 is not online. Jayskull900
Joined: 26 Nov 2006
Total Posts: 590
21 Oct 2013 09:57 PM
I would listen to him, using FindFirstChild() is more convenient here. However, Debounce works like this..

db = true
if not db then
wait(3)
db = false
end
Report Abuse
RobinsHssm is not online. RobinsHssm
Joined: 09 Nov 2011
Total Posts: 805
21 Oct 2013 09:59 PM
Okay so could one of you write the script again but use the FindFirstChild() please.
Report Abuse
Jayskull900 is not online. Jayskull900
Joined: 26 Nov 2006
Total Posts: 590
21 Oct 2013 10:01 PM
Or, now stay with me here, you COULD write it yourself... I feel like you haven't done any of the work on your own. I apologize but I'm not going to do your work for you, if you'd like a link to the wiki, I'll be happy to provide it for you.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
21 Oct 2013 10:01 PM
script.Parent.Touched:connect(function(hit) i pcall(function()
if not game.Players:getPlayerFromCharacter(hit.Parent).Backpack:FindFirstChild("LinkedSword") then
game.ServerStorage.LinkedSword:clone().Parent=game.Players:getPlayerFromCharacter(hit.Parent).Backpack end end) end)
Report Abuse
RobinsHssm is not online. RobinsHssm
Joined: 09 Nov 2011
Total Posts: 805
21 Oct 2013 10:02 PM
I've made the whole script, I just don't understand how to do the FindChild thing. Other than that, I've made the whole script.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
21 Oct 2013 10:02 PM
if you know pcall when you don't know FindFirstChild, or even simple variables, then you obviously didn't make the script.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
21 Oct 2013 10:03 PM
I agree with cnt here.
Report Abuse
RobinsHssm is not online. RobinsHssm
Joined: 09 Nov 2011
Total Posts: 805
21 Oct 2013 10:04 PM
I did, I looked at a tutorial though. Im beginner so what? :(
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
21 Oct 2013 10:05 PM
So you "typed it" but, you didn't actually put any brain power into doing it besides typing. Assuming you even did that...
Report Abuse
Jayskull900 is not online. Jayskull900
Joined: 26 Nov 2006
Total Posts: 590
21 Oct 2013 10:06 PM
Well, pcall is an advanced function. FindFirstChild() is a rather simplistic one. It does not seem likely that you could both understand and use pcall but not even know the name of the FFC method.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
21 Oct 2013 10:08 PM
pcall is not advanced, but it's more advanced than the method :FindFirstChild
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