So i found a script in where when a player touches a certain block, they get an item from the replicated storage. But when the player touches the block the block will keep on giving the player the item without a wait. What I want is the script to give the player the item but then to have a small wait (3 sec) so that when the player touches the brick it doesnt give the player like 5 swords, or 6 bow and arrows.
script.Parent.Touched:connect(onTouch) function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid and players[i].Backpack:FindFirstChild("GhostBurger") == nil then return players[i] end end return nil end function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if (human == nil) then return end local player = getPlayer(human) if (player == nil) then return end game.ReplicatedStorage:findFirstChild("Bow and Arrow"):clone().Parent = player.Backpack wait(10) end script.Parent.Touched:connect(onTouch)
i need help a
This isn't exactly what you're wanting but... if you put this within a script in a 'block'; This will allow players to get whatever item it is. Only if they don't already have it. So they can ONLY GET THE ITEM ONE TIME!
local part = script.Parent local tool = game:GetService('ReplicatedStorage'):FindFirstChild('ITEMNAMEHERE') if tool then part.Touched:Connect(function(hit) if hit and hit.Parent then local humanoid = hit.Parent:FindFirstChild('Humanoid') if humanoid then local player = game.Players:GetPlayerFromCharacter(humanoid.Parent) if player then if not player.Backpack:FindFirstChild(tool.Name) and not humanoid.Parent:FindFirstChild(tool.Name) then tool:Clone().Parent = humanoid.Parent end end end end end) end