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!
A decay script for when a brick is unanchored, it decays and destroys itself.
What is the issue? Include screenshots / videos if possible!
It doesnt appear to work, but no errors are present.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
None, yes, found nothing.
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!
I use a second script called “Setup” in the workspace to clone the decay script to bricks.
Setup script:
while true do
local brick=workspace:WaitForChild("Brick")
local ss=game:GetService("ServerStorage")
local clone=ss.Decay:Clone()
workspace:WaitForChild("Brick")
clone.Parent=brick
task.wait(0.02)
end
Decay script:
if script.Parent.Name=="Brick" then --check
if script.Parent.Anchored==false then --check 2
task.wait(10)
script.Parent.Material=Enum.Material.CorrodedMetal
task.wait(2)
script.Parent:Destroy()
end
end
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.
It’s possible that the script starts before you clone it into the brick, skipping the decay part because script.Parent.Name ~= "Brick". You could do two things to fix this:
The first thing is to enable the script once you parent it to the brick. Set the script’s enabled property to false in the explorer. Then, in your first script after setting the clone’s parent to brick, you set the scripts enabled property to true like clone.Enabled = true.
The second thing you can do is to detect changes that fire when the brick is reparented or unanchored using connections. Although, I am not sure what exactly you want to detect here so I can’t give one example for this case.
local brick=workspace:WaitForChild("Brick")
local ss=game:GetService("ServerStorage")
local clone=ss.Decay:Clone()
workspace:WaitForChild("Brick")
clone.Parent=brick
change the setup to this. No reason to loop anything
Yeah idk what you did man i’m sorry I know how real the struggle is sometimes with this stuff im just guna send you the file and you do what you want with it, it does exactly what you guys are trying to do
Please try and be patient when someone is fixing your game instead of flooding the thread. I am not even supposed to be handing you scripts without you understanding how they work… I did this out of kindness. I hope you’re happy with it!