Hi I am wondering how can I code my code to know when a player isn't clicking on my gui button
Example of player clicking button now how can I check if they aren't??
script.parent.Mousebutton1clickdown:connect(function() end)
Thanks
Sound script
local Button = script.Parent local Clicked = false Button.MouseButton1Down:Connect(function() Clicked = true while Clicked do game.ReplicatedStorage.Sound:FireServer() wait(.2) end game.ReplicatedStorage.Soundstop:FireServer() end) Button.MouseButton1Up:Connect(function() Clicked = false end)
You can use a variable to determine if the player is clicking the button; if the variable is false, the player is not clicking the button.
local Button = script.Parent local Sound = script.Parent.Sound local Clicked = false Button.MouseButton1Down:Connect(function() Clicked = true while Clicked do Sound:Play() Sound.Ended:Wait() end Sound:Stop() end) Button.MouseButton1Up:Connect(function() Clicked = false end)