Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Explosion destroying anything that is a model(anything at all except locked parts)?

ok so the question and the script are pretty explainitory with this one so im just gonna explain the errors there are multiple

so first off like the question says it destroys any model unless its parts are locked

second is this but it is connected to the part it prints off

  11:59:09.264 - ServerScriptService.Script:5: attempt to index field 'Parent' (a nil value)
11:59:09.268 - Stack Begin
11:59:09.268 - Script 'ServerScriptService.BlowBarrel', Line 5
11:59:09.269 - Stack End

third is this same as the last it is also connected to the part it prints off

  11:59:18.430 - The Parent property of Workspace is locked
11:59:18.431 - Stack Begin
11:59:18.431 - Script 'ServerScriptService.BlowBarrel', Line 6
11:59:18.432 - Stack End

then finally here is the script:

workspace.ChildAdded:Connect(function(obj)
	if obj:IsA("Explosion") then
		obj.Hit:Connect(function(basePart, distance)
			print(basePart.Name)
			if basePart.Parent.Name == "BlueBarrel" or "RedBarrel" then
				basePart.Parent:Destroy()
			end
		end)
	end
end)

its like the game just completely ignores line 5

3 comments

0

Check if the part is locked

0

it destroys all parts in a model if they are not locked but as the script says thats not what im wanting

0

yesterday this worked fine with no errors except workspace errors

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.