So i have this script that spawns a part when 'e' is pressed but i want to know how cna i make it so the part destroys after a few seconds and then the script is on cooldown
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(Key) Key = Key:lower() if Key == 'e' then print'e' local Part = Instance.new('Part', game.Workspace) Part.Anchored = true Part.CFrame = Player.Character.Head.CFrame * CFrame.new(0,0,-5) end end)
https://www.youtube.com/watch?v=mHDarhgxvNg here is a video of what the script does, i want to make it so when you press it once it goes on cool down and after 5 seconds the part destroys
Heyyy you could do (this is an Example)
Instance.new(“Part”) local Part = game.Workspace.Part wait(1) Part:Destroy()