Explosion type not working

  1. What do you want to achieve? I want the explosion to not break terrain, it’s set on “NoCraters”

  2. What is the issue? The explosion breaks my terrain even though it’s set on “NoCraters”. I also have tried debugging with the print code, but no success because it didn’t print at all.

  3. What solutions have you tried so far? I have tried getting help from AI, I looked in the dev forum, and still couldn’t get the issue resolved.

Some details: It’s a script not a local one, it’s located in replicatedstorage.

That’s all you need, I guess. If you need more details just ask.

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

RemoteEvent.OnServerEvent:Connect(function(player)

    local function explosion()
        local explode = Instance.new("Explosion")
        explode.Position = Vector3.new(0, 50, 0)
        explode.BlastRadius = 350
        explode.BlastPressure = 75000000
        explode.DestroyJointRadiusPercent = 0
        explode.Parent = game.Workspace
        explode.ExplosionType = Enum.ExplosionType.NoCraters

        print("Explosion Type:", explode.ExplosionType)

        game.Workspace.Gravity = 0

        task.wait(0.5)
        explode:Destroy()
        game.Workspace.Gravity = 196.2
    end

    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
end)

You’re parenting the explosion to the Workspace before you set it’s ExplosionType. ExplosionType has to be modified first:

explode.ExplosionType = Enum.ExplosionType.NoCraters
explode.Parent = game.Workspace
-- ...Continue

I’m gonna try this out, thanks.

Update:

It didn’t work, I can show you the rework though:

local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")

RemoteEvent.OnServerEvent:Connect(function(player)

    local function explosion()
		local explode = Instance.new("Explosion")
		explode.ExplosionType = Enum.ExplosionType.NoCraters
		explode.BlastRadius = 150
		explode.BlastPressure = 2500000
		explode.Position = Vector3.new(0,0,0) + Vector3.new(0,50,0)
		explode.DestroyJointRadiusPercent = 0
		explode.Parent = game.Workspace
		game.Workspace.Gravity = 0
		print("Explosion Type:", explode.ExplosionType)

        game.Workspace.Gravity = 0

        task.wait(0.5)
        explode:Destroy()
        game.Workspace.Gravity = 196.2
    end

    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
    task.wait(0.1)
    explosion()
end)

No print’s at all.

It may very well be that the remote event RemoteEvent is simply not being fired from the client, consider reviewing the scripts that fire that event, and ensure that they all do in fact fire the event.

The script that fires the RemoteEvent is a localscript so it should fire the RemoteEvent since it’s the only script I have that fires a Remoteevent. I have checked out the script it seems okay. It’s a local script for the client that fires a RemoteEvent to the server and then uses a Script to execute action(explosion). I haven’t found any errors too. The localscript is located in a textbutton and the receiver is located in replicatedstorage.

Hey, it has been an hour. Sorry for being inpatient, I just don’t know if you forgot about this topic or if you’re just offline.

Try replacing ‘game.ReplicatedStorage’ with 'game:GetService(“ReplicatedStorage”). Also, do you have multiple remote events? If so, then try renaming the target remote event to something else.

1 Like

Can you share us the code where to LocalScript fires the remote event? @D4_rrk had a good point; the remote event might not be firing correctly.

1 Like

I only have 1 remoteevent, I’ll try this out.

Uh sure, just let me apply the idea of the other person.

Also you need to change the line of code that prints the explosion type. Right now, if it ran correctly, you’d get this error:


Change this line

print("Explosion Type:", explode.ExplosionType)

to this:

print("Explosion Type:", explode.ExplosionType.Name) --'Name' shows the name of the enum. 


(fixed line)

Where shall i put the line of code? In which script?

In the serverscript. Replace the print("Explosion Type") line with the one I showed above.

like this? [edited: Oh wait I replied to the replicatedstorage one, I wanted to ask in which script I should put it.]
image

local RemoteEvent = game:GetService("ReplicatedStorage")

:GetService() acquires the specified service you’re looking for. It’s better than using game.ReplicatedStorage because I’m pretty sure it’s more accurate

1 Like


no prints :c

Could you show us the code in the localscript?

Sorry if it’s a bit messy, I’m new to this. This is the fire signal though. [edited: 50% of this script was made with AI because of the buying option.]

local button = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("RemoteEvent")
local productidd = 1839490031
button.Visible = false
local function handleButtonVisibility()
	while true do
		local duplicants = game.Workspace.duplicants:GetChildren()
		local foundPart = false
		for _, child in ipairs(duplicants) do
			if child.Name == "Part" then
				foundPart = true
				break
			end
		end
		if foundPart then
			task.wait(8)
			button.Visible = true
			break
		end
		wait(0.1)
	end
end
handleButtonVisibility()
button.MouseButton1Click:Connect(function()
	button.Visible = false
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productidd)
end)
game:GetService("MarketplaceService").PromptProductPurchaseFinished:Connect(function(player, produid, waspurch)
	if produid == productidd then
		if waspurch then
			remoteEvent:FireServer()
		else
			button.Visible = true
		end
	end
end)
task.wait(60)
button.Visible = true

Yes, just sent it. Take a look. 19th post