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: Having issues with this script

Previous Thread :: Next Thread 
Dust707 is not online. Dust707
Joined: 27 Sep 2011
Total Posts: 2613
24 Oct 2014 11:41 PM
Hi. I've been having issues with this script, I've played with my friends and you can only take one thing one time. Please help.





local debounce = false

function getPlayer(humanoid)
local players = game.Players:children()
for i = 3, #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

script.Parent:clone().Parent = player.Backpack

wait(5)
debounce = false
end
end


script.Parent.Parent.Touched:connect(onTouch)
Report Abuse
Dust707 is not online. Dust707
Joined: 27 Sep 2011
Total Posts: 2613
24 Oct 2014 11:42 PM
bumpsies
Report Abuse
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
24 Oct 2014 11:50 PM
Well one thing I noticed,

You set players to "game.Players:children()" < error

You miss used children its supposed to be game.Players:GetChildren()

local debounce = false

function getPlayer(humanoid)
local players = game.Players:GetChildren()
for i = 3, #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

script.Parent:clone().Parent = player.Backpack

wait(5)
debounce = false
end
end


script.Parent.Parent.Touched:connect(onTouch)
Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
24 Oct 2014 11:57 PM
--This should work:

DB = true
script.Parent.Parent.Touched:connect(function(part)
local hum = part.Parent:FindFirstChild'Humanoid'
local p = game.Players:FindFirstChild(hum.Parent.Name)
if hum and p and DB then
DB = false
script.Parent:clone().Parent = p.Backpack
wait(3)
DB = true
end
end)
Report Abuse
murcury57 is not online. murcury57
Joined: 30 Jun 2010
Total Posts: 90299
25 Oct 2014 12:17 AM
[ Content Deleted ]
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
25 Oct 2014 12:20 AM
local debounce = false

function onTouch(part)
if not part.Parent then return end
if not debounce then
debounce = true
local player = game.Players:GetPlayerFromCharacter(part.Parent)

if not player then debounce = false return end

script.Parent:clone().Parent = player.Backpack

wait(5)
debounce = false
end
end
script.Parent.Parent.Touched:connect(onTouch)


Talking in third person annoys people.
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