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

Can someone help with my script?

Whenever you touch the part you get given multiple swords (For example 9 swords in one touch) how could you limit this to one sword on each touch?

script.Parent.Touched:connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then -- checking if the part is a child of the character
        player = game.Players:GetPlayerFromCharacter (part.Parent) -- find the player
        Tool = game.Workspace.LinkedSword:Clone()
        Tool.Parent = player.Backpack
    end
end)

1 comment

0

You need debounce.

1 answer

✓ Accepted answer
debounce=false
script.Parent.Touched:connect(function(part)
if debounce==false then
debounce=true
    if part.Parent:FindFirstChild("Humanoid") then -- checking if the part is a child of the character
        player = game.Players:GetPlayerFromCharacter (part.Parent) -- find the player
        Tool = game.Workspace.LinkedSword:Clone()
        Tool.Parent = player.Backpack
	wait(5)--Change this to the time you want it to be
debounce=false
    end
end
end)

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