Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would you clone a local script to a backpack?

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

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)

2 comments

0

could you get it to clone only once?

0

Add a debounce to it.

This discussion is preserved as it was. New answers, comments, and votes are closed.