i have this so far!
function onTouched(part) while true do wait(2) script.Workspace.Baseplate.ontouch.Smoke.Enabled = true end end script.Parent.Touched:connect(onTouched)
i need it to end in 2.8 secs
I wrote this on mobile.
local beingTouched = false workspace.Baseplate.Touched:Connect(function(touch) if not beingTouched then beingTouched = true sound:Play() smoke.Enabled = true wait(2.8) sound:Stop() smoke.Enabled = false beingTouched = false end end)
Ok so when the baseplate is touched it connects a function to that touch. (I used an anonymous function by just creating the function inside the connect method) It will check beingTouched is false (the not operator is for r opposite. if not true then basically) It sets our var to true so the code block doesn't run the effects again for another 2.8 seconds (cant pass first check again now). It plays the song and enables smoke, waited 2.8 stops the music and smoke, changes var back to false so it can run the code block again.