So yesterday i asked why it would give tools to everyone. Now it gives infinite tools??

Here's the script

local Part = game.Workspace.BuyPart
local RS = game:GetService("ReplicatedStorage")
local Sword = RS.Tools:FindFirstChild("SpeedCoil")
local Players = game:GetService("Players")

Part.Touched:Connect(function(hit)
	
	local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
	
	if Player.leaderstats.Points.Value >= 500 then
		local SwordClone = Sword:Clone()
		SwordClone.Parent = Player.Backpack
	end
	
	local GravityCoil = RS.Tools:FindFirstChild("GravityCoil")
	local Part1 = game.Workspace.BuyPart1
	
	Part1.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			
			
			if Player.leaderstats.Points.Value >= 7000 then
				local CoilClone = GravityCoil:Clone()
				
				CoilClone.Parent = Player.Backpack
				
	end
	
	local Part2 = game.Workspace.BuyPart2
	local Tool = RS.Tools:FindFirstChild("PointGiverTool")
	
	Part2.Touched:Connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") then
	
			
			if Player.leaderstats.Points.Value >= 10000 then
				local ToolClone = Tool:Clone()
				ToolClone.Parent = Player.Backpack
				
			end
			end
			end)
				end
				end)
					end)

please help

5 comments

0

This happen because Touch event can fire multi times when the Player move. To prevent this, we use debounce https://developer.roblox.com/en-us/articles/Debounce

0

Still does not work.

0

does not work.

0

Use a debounce if the tool already exists within their backpack

0

Do you know the script : -) I'm a beginner