Hey, I'm trying to make an if statement that technically destroys a door if it is open for over 20 seconds. I have a horrible script of it. Please make corrections to it.


Door=game.ServerStorage.Door 

if Door.Parent == game.Workspace then
	game.Workspace.Door:Destroy()
	game.ServerStorage.Door.Name = "Door1"
	wait(20)
	game.ServerStorage.Door1.Name = "Door"

end 

Changing the name to Door1 is basically making it so another script can't clone "Door" from serverstorage.

2 comments

0

It's kind of confusing what you're trying to do here. Could you elaborate a little more?

0

ServerStorage isn't a service that exists in servers, use ReplicatedStorage instead.