For a brief background i'm creating a script that when you touch it you get an item with a specific amount of points but it's not working
Either it's not working, or it's giving me infinite of the same items. I dont want any debouce or anything
Is there anyway to check if the player already has the item?
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()
if Player.Backpack:WaitForChild("SpeedCoil") then
SwordClone.Parent = Player.Backpack
SwordClone = false
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()
if Player.Backpack:WaitForChild("GravityCoil") then
CoilClone.Parent = Player.Backpack
CoilClone = false
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()
if Player.Backpack:WaitForChild("PointGiverTool") then
ToolClone.Parent = Player.Backpack
ToolClone = false
end
end
end
end)
end
end
end)
end
end)
Thank you for your time

4 comments
check also if the player's character has the tool, cuz if the player equips the tool it will delete the tool in the player's backpack and clone it in the player's character
can you give me the script
Lol, you need a debounce
JUST GIVE ME A SCRIPT I HAVE USED 3 DAYS ON THIS GARBAGE