~~~~ local Giver = script.Parent
local Gear = game.ReplicatedStorage.Morphs.SasukeClassic
local takeable = true
function onTouch(Brick)
if takeable then
local Player = Brick.Parent:findFirstChild("Humanoid")
if (Player ~= nil) then
local Location = game:GetService("Players"):GetPlayerFromCharacter(Player.Parent)
local New = Gear:Clone()
New.Parent = Location.Backpack
local takeable = false
wait(5)
local takeable = true
end
end
end
Giver.Touched:connect(onTouch) ~~~~~~
Hey Nanzito!
You gotta make a variable that stops the script from running over and over. The wait() is only to wait before executing an another part of the script and it will not delay an another execution of the script.
I'll show you an example of how this can be solved:
local Giver = script.Parent local Gear = game.ReplicatedStorage.Morphs.SasukeClassic local takeable = true function onTouch(Brick) if takeable == true then takeable = false --Added this to make this piece of code not-executable before we make it true again. local Player = Brick.Parent:findFirstChild("Humanoid") if (Player ~= nil) then local Location = game:GetService("Players"):GetPlayerFromCharacter(Player.Parent) local New = Gear:Clone() New.Parent = Location.Backpack end wait(5) -- Here's the cooldown takeable = true -- Making the script executable again. end end Giver.Touched:connect(onTouch)
I think you were kinda onto something with the "takeable" variable. You just placed it in some wrong spots. ^^
Happy coding!