Hey all,
Was wondering how I could make explosions only harm certain parts, like in doomspire brickbattle:
Is anyone able to explain how to do this?
Hey all,
Was wondering how I could make explosions only harm certain parts, like in doomspire brickbattle:
Is anyone able to explain how to do this?
Doomspire Brickbattle actually has allow copying enabled so if you wanted you could go in and check to see how it works in case you wanted to figure out other similar mechanics as well.
i tried to take a few assets from the game and test them on a baseplate, none of them work though, even though there are no errors in the console.
On line 10 of the ServerScript for the bomb it requires a module called Other in ReplicatedStorage, which from reading it over briefly looks to be the script responsible for what you are talking about in your post.
local bomb = Instance.new("Part")
bomb.Size = Vector3.new(2,2,2)
bomb.BrickColor = BrickColor.new("Really black")
bomb.Shape = 0
bomb.BottomSurface = 0
bomb.TopSurface = 0
bomb.Name = "Bomb"
bomb.Locked = true
local ModFx=require(game.ReplicatedStorage.Other) --requires module
There are probably other resources that it uses then. There is a bindeable event in ServerScriptService named “b” that is fired by the bomb ServerScript as well, which a script in ServerScriptService listens for and then uses the “Other” module again.
You would loop through all the parts the exploision touches/is in the region of the explosion and compare the names or the instances with whatever you want it to hurt then if a name that its looping through matches deal some damage to that part/ the humanoid.
Show some of your script or give some detail as to how you have got to where you are so you can get a better tailored answer.
in doomspire brick battle each part is coloured according to its team colour.
if you are on yellow team the script running on the bomb probably gets the team colour you are on in this case yellow, and it will compare this to what the bomb is hitting if it is the same color as the team it will not go off. when the bomb goes off a region is set around it (a blast radius for a bomb), it will then loop through all the parts checking they arent the same as the team color.
for i,v in pairs (PartsInTheRegion) do
if v ~= LocalTeamColour then
do damage
end
end
theres two ways to approach this: assign each team’s brick to a collision group, or just check for their colour;
in the end you either want to check the bricks via an invisible ball going “GetTouchingParts” or you use “GetPartsInRegion3”