I want someone to have to hold down MouseButton1 for like 2 seconds in order for the block to be destroyed here is my code right now?
local UserInputService = game:GetService("UserInputService")
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Distance = 15
local MouseButton1Down = false
UserInputService.InputBegan:Connect(function(InputBegan)
if InputBegan.UserInputType == Enum.UserInputType.MouseButton1 then
MouseButton1Down = true
while wait() and MouseButton1Down do
if Mouse.Target then
Mouse.Target:Destroy()
end
end
end
end)
UserInputService.InputEnded:Connect(function(InputEnded)
if InputEnded.UserInputType == Enum.UserInputType.MouseButton1 then
MouseButton1Down = false
end
end)