You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Basically I want the script & the parent to delete itself after a certain duration, With the duration having different values, which is set by other scripts. -
What is the issue? Include screenshots / videos if possible!
wait() or task.wait() doesn’t seem to be accepting variables from attributes, note that this is a server script with the duration attribute of script.Parent set to 5. The path’s are working as i have other :Getattribute calls that works perfectly, it’s precisely the “wait()” command that’s not working for me nor, does the task.wait(). Everytime I run the code there is absolutely no delay in the script -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried looking at the hub and no one seems to tackle this issue precisely.
I’ve tried using tonumber() or to string(), I’ve tried directly inserting a value inside the wait() call i.e wait(5) & it works perfectly. It just that when it is a called attribute that the issue arises.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
print("Should Run After "..script.Parent:GetAttribute("Duration").." seconds?")
local dur = script.Parent:GetAttribute("Duration")
task.wait(dur)
print("ran")
game:GetService("Debris"):AddItem(script.Parent,0)
game:GetService("Debris"):AddItem(script,0)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.