I’d like to make a part which can be destroyed (using script) within a certin amount of time.
I tried to make a script so that it can do this, but it came up with an error. I will show you the code first.
Now this is the error that keeps coming up.
I had an idea on how to fix this error, which is to remove the script from serverscript service.
But I don’t think that would work, and it would lead my game prone to hackers.
I really hope somone can help me with this, and just to let you know I am a beginner scripter.
Thank you.
Normal scripts can’t be viewed by exploiters as they are not replicated to the client. I assume when you reference Wall you’re actually referencing the ServerScriptService, which is a service and cannot be destroyed. Your game will not be vulnerable to exploiters if you move the script into the part.
There’s a service for this called Debris. You can use it to set a lifetime for a specific instance, it then get’s destroyed after it outlives it’s lifetime.
local Debris = game:GetService("Debris")
local Part = Instance.new("Part")
Part.Parent = workspace
Debris:AddItem(Part, 10)