Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you clone a local script to a backpack?

Asked by 10 years ago

I'm using something like this: local debounce = false

function OnTouch(hit) if hit.Parent == nil then return end a = hit.Parent:FindFirstChild("Humanoid") if a ~= nil then

end end script.Parent.Touched:connect(OnTouch)

1 answer

Log in to vote
0
Answered by
Cizox 80
10 years ago
script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local lScript = game.ServerStorage:findFirstChild('LocalScript'):Clone()
lScript.Parent = player.Backpack
end
end)
0
could you get it to clone only once? BloxAdventure 0 — 10y
0
Add a debounce to it. Cizox 80 — 10y
Ad

Answer this question