So I have a lever and when you pull it, it makes a sound. But I want it to play a special sound only when it gets clicked within 1 second. How would I do this? Here is what I have so far:
function matlever() -- manages the whole demat / move / mat thing
if script.Parent.Variables.Power.Value == true and script.Parent.Variables.Override.Value == false then
if status.Value == 0 then
status.Value = 1
if converted == true then
script.Parent.Variables.rdoor.Value = true
end
matleversound:Play()
local g = script.Parent.Controls.Matlever.Land:GetChildren()
for i = 1,#g do
g[i].Transparency = 0
g[i].CanCollide = true
end
local g = script.Parent.Controls.Matlever.Fly:GetChildren()
for i = 1,#g do
g[i].Transparency = 1
g[i].CanCollide = false
end
fly.Value = true
demat()
move()
elseif status.Value == 2 then
status.Value = 3
matleversound:Play()
local g = script.Parent.Controls.Matlever.Land:GetChildren()
for i = 1,#g do
g[i].Transparency = 1
g[i].CanCollide = false
end
local g = script.Parent.Controls.Matlever.Fly:GetChildren()
for i = 1,#g do
g[i].Transparency = 0
g[i].CanCollide = true
end
move()
repeat
wait(0.1)
until script.Parent.Variables.ExtChange.Value == false
mat()
fly.Value = false
status.Value = 0
if converted == true then
script.Parent.Variables.rdoor.Value = false
end
end
end
end
script.Parent.Controls.Matlever.Fly.Fly.ClickDetector.MouseClick:connect(matlever)
script.Parent.Controls.Matlever.Land.Land.ClickDetector.MouseClick:connect(matlever)

2 comments
How would I play the sound if It is clicked within 1 second? And: if function==true then is underlined red on my script.
Oh, sorry. I fixed it. It wasn't supposed to say function. It was supposed to say "Able".