|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 21 Oct 2013 09:59 PM |
| Okay so could one of you write the script again but use the FindFirstChild() please. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
|
| 21 Oct 2013 10:04 PM |
| I did, I looked at a tutorial though. Im beginner so what? :( |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|