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

how do i make it so i dont get the linked sword more than one time?

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	local LinkedSword = game.ServerStorage.ClassicSword:Clone()
	LinkedSword.Parent = player.Backpack
end)

1 answer

✓ Accepted answer

What you need is a debounce to make sure people won't get the sword more than once on accident:

local debounce = false

script.Parent.Touched:Connect(function(hit)
	if not debounce then
		debounce = true
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		local LinkedSword = game.ServerStorage.ClassicSword:Clone()
		LinkedSword.Parent = player.Backpack
		wait(3)
		debounce = false
	end
end)

Hope this helped!

2 comments

0

Use delay() instead of wait(3), cause he is gonna get problems if he scripts something below this function

0

i need a limit

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