Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
omzig
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 578 |
|
|
| 29 Jul 2012 11:05 PM |
"Random on how many times it will work."
Meaning it gives someone a tool multiple times, or that it only gives one person a tool? |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
omzig
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 578 |
|
|
| 29 Jul 2012 11:24 PM |
Crypt,
I tend to make functional scripts, and they just work.
When I make a glitchy fix I don't really repair it, I ask SH for that.
I don't know how to *repair* scripts too well. I see the code and it looks functional, but it's a bit glitchy. I cna't repair that. |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
omzig
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 578 |
|
|
| 29 Jul 2012 11:30 PM |
| Could you check output for me, then maybe I could find out what's wrong and help you out? |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
|
| 29 Jul 2012 11:39 PM |
Eerg, unless you use :WaitForChild() in the clone().Parent Part. Just try this (maybe?):
local debounce = false
function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
local tool = script.Parent:clone() tool.Parent = player.Backpack
wait(.5) debounce = false end end
script.Parent.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
omzig
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 578 |
|
|
| 29 Jul 2012 11:43 PM |
| That makes the script run for every player in the game. |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2012 11:43 PM |
| Nope, but I like for i, v in pairs() a lot better |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
omzig
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 578 |
|
|
| 29 Jul 2012 11:47 PM |
Crypt,
Your script isn't *broken*,
It's just glitchy. Something causes it to break when it does, and I don't know what.
If I could find out what that error was, maybe I could fix it.
but there's no way to find out. So you might want to rewrite this a different way, and see if that makes it less glitchy. |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
omzig
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 578 |
|
|
| 29 Jul 2012 11:53 PM |
Why not anchor all the bricks in the model, and when the new player gets it it unanchors it.
Or even easier:
Put the tool in lighting, and clone it from there... |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|
omzig
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 578 |
|
|
| 29 Jul 2012 11:56 PM |
Ok, glad to of *helped* (Astricks because I did hardly anything figuring it's buggy, not broken).
Tell me when your game is done, and I'll come check it out. :) |
|
|
| Report Abuse |
|
|
Cryptonix
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 17164 |
|
| |
|