#Button not working if i play the game for too long
1 messages · Page 1 of 1 (latest)
local model = script.Parent
local button = model:FindFirstChild("RedButton")
local redtext = model:FindFirstChild("Red")
local door = model:FindFirstChild("Door")
local DelClickDetector = model.RedButton:FindFirstChild("ClickDetector")
local PressSound = model:FindFirstChild("PressSound")
local EndSound = model:FindFirstChild("EndSound")
local TalkingMan = model:FindFirstChild("TalkingMan")
local clicked = false
local function click()
if clicked then return end
clicked = true
if PressSound then
PressSound:Play()
end
if redtext then
redtext.Transparency = 0
end
task.wait(0.7)
if TalkingMan then
TalkingMan:Play()
end
task.wait(1) --how many secs man and +1
if EndSound then
EndSound:Play()
end
if door then
door:Destroy()
end
if DelClickDetector then
DelClickDetector:Destroy()
end
end
button.ClickDetector.MouseClick:Connect(click)
It should work fine
There's no error in 'this' script.
Maybe tell us about other scripts dealing with this button model
this is the only script in the model and theres no other scripts interacting with it i think
@daring apex try adding print statement under each if statement and code below - to debug it fully
okay
i think the click detector isnt working after some time but i see the clickdetector in explorer
@gritty abyss
Add print above if clicked yhen return rnd and lmk
like this?
@gritty abyss only prints that
Well yeah then click detector is broken - check whenever you are actually clikcing on it
memory leaks ig
maybe
youre not checking if its being clicked
nevermind what i said
np
Are you using cas anywhere