|
script.Parent.Touched:connect(function onTouch(hit)
if hit.Parent then
a = game.Players:FindFirstChild(hit.Parent.Name)
game.Lighting["Tool"]:clone().Parent = game.Players.FindFirstChild(hit.Parent.Name).Backpack
end
end)
its not working, meant to clone a tool from lighting into the player that touches the part's backpack |
|
|
script.Parent.Touched:connect(function(hit)
if hit.Parent:IsA("Model") then
a = game.Players:findFirstChild(hit.Parent.Name)
local clone = game.Lighting["Tool"]:clone()
clone.Parent = game.Players:findFirstChild(hit.Parent.Name).Backpack
end end) |
|
|
works but lol i think i need debounce, it cloned like 10 of them |
|
|
You probably know how to make debounce but here you go:
local debounce = false
script.Parent.Touched:connect(function(hit)
if debounce == true then debounce = true
if hit.Parent:IsA("Model") then
a = game.Players:findFirstChild(hit.Parent.Name)
local clone = game.Lighting["Tool"]:clone()
clone.Parent = game.Players:findFirstChild(hit.Parent.Name).Backpack
end wait(1) debounce = false end end)
Also, in the future please try to avoid making duplicate posts or at least bury the previous threads. |
|
|
ok and this fixed the debounce, just unsure if it will work when the player respawns or another player wants to take the tool but k
debounce=true
script.Parent.Touched:connect(function(hit)
if hit.Parent:IsA("Model") then
a = game.Players:findFirstChild(hit.Parent.Name)
local clone = game.Lighting["Tool"]:clone()
clone.Parent = game.Players:findFirstChild(hit.Parent.Name).Backpack
elseif game.Players.findFirstChild(hit.Parent.Name.Backpack.Tool) then
return false
end
debounce=true
end) |
|
YeahNickJoin Date: 2009-02-28 Post Count: 2536 |
ok i'm just rewriting your whole script
script.Parent.Touched:connect(function(h)
if h.Parent:FindFirstChild("Humanoid") then
local p = game.Players:FindFirstChild(h.Parent.Name)
if p then
local t = game.Lighting.Tool:Clone()
t.Parent = p.BackPack
end
end
end)
this should work try it out |
|
|
omg seriously its broke again because i renamed the tool to Infopad and put handles and stuff in the tool and i changed the name of it in the script too and its not working |
|
|
Change the name back to "Tool". |
|
|
|
the debounce is broke omg
this works but when i add the debounce it breaks
script.Parent.Touched:connect(function(hit)
if hit.Parent:IsA("Model") then
a = game.Players:findFirstChild(hit.Parent.Name)
local clone = game.Lighting["Tool"]:clone()
clone.Parent = game.Players:findFirstChild(hit.Parent.Name).Backpack
end wait(1) end) |
|
|
omg this is starting to get on my nerve help |
|
YeahNickJoin Date: 2009-02-28 Post Count: 2536 |
wtf did u even try my version |
|
|
ya and it has no debounce |
|
|
|
|
smiley599Join Date: 2010-01-23 Post Count: 21869 |
script.Parent.Touched:connect(function(hit)
a = game.Players:findFirstChild(hit.Parent.Name)
if a then
if not a.Backpack:findfirstChild("Tool") then
local clone = game.Lighting["Tool"]:clone()
clone.Parent = game.Players:findFirstChild(hit.Parent.Name).Backpack
end
end
end) |
|
|
not working but hi smiley frend |
|
smiley599Join Date: 2010-01-23 Post Count: 21869 |
It looks fine? Output?
and hi friend |
|
|
test it urself if u think its right this is exactly wat i hav
name of part is purrt
script is inside it
in lighting the tool is called tool
|
|
|
|
Tool = game.Lighting.Tool:Clone()
function AddTouch(Toucher)
if Toucher.Parent game.Players:FindFirstChild(Toucher.Parent.Name)
Player = game.Players:FindFirstChild(Toucher.Parent.Name)
Tool.Parent = Player.Backpack
end
end
script.Parent.Touched:connect(AddTouch) |
|
YeahNickJoin Date: 2009-02-28 Post Count: 2536 |
@above
That'll only work once
put the :clone() part in the function |
|
|
anon's script works ok as long as the person throws the tool away and then goes back again for it and thats the point k thx anon
but it could be kinda improved, glitches a lot |
|
lostendJoin Date: 2011-08-21 Post Count: 8265 |
script.Parent.Touched:connect(function onTouch(hit)
ypcall(function()
if hit.Parent:IsA'Model' and not game:service'Players'[hit.Parent.Name].Backpack:FindFirstChild('Tool')then
local tool=game:service'Lighting':WaitForChild'Tool':Clone()
tool.Parent=game:service'Players'[hit.Parent.Name].Backpack
end
end)
end) |
|