I have been trying to make a script that destroys the model it is in when a certain block is destroyed. When I destroy the block, it explodes like it is meant to, but the model isn't removed. So far I have got:
blueteamlive = script.Parent:FindFirstChild("Team Block") while true do if blueteamlive ~= nil then game.Workspace.Spawns.Red = BrickColor.new(1001) else script.Parent:remove() end
end
I have no idea if the script would work if nothing was inserted where I have put the Spawn brick color changer. I know something is wrong, but I don't know what. Can someone please help?
Change this line:
game.Workspace.Spawns.Red = BrickColor.new(1001)
to this:
game.Workspace.Spawns.BrickColor = BrickColor.new(1001)
Assuming Spawns is a SpawnLocation, it has a "BrickColor" property that you can set. However, it doesn't have a property named Red.
:remove() is deprecated. Use the Destroy method.
Change line 7 to this:
script.Parent:Destroy()