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 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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
wow thanks! i'll try it!
Well, the smoke stays..
This works, but the smoke has a lifetime of seconds it has until it fades away.
Well that was the objective I thought, Sickings. If OP was several he can add a new smoke instances and debris.