I tried to create a bomb but it stops working and it doesn’t give me an error either.
The bomb is a tool and I put the explosion script inside the handle and when the tool is activated, the handle is cloned and is parented to workspace at the player position.
But the bomb only works while I’m holding it and once I drop it and parent it to workspace, it doesn’t seem to explode.
This is what I mean:
Would you mind showing us the code in your explodescript so we can check for problems directly?
Inside the handle [SCRIPT]
local function explosion()
local explode = Instance.new("Explosion")
explode.Parent = game.Workspace
explode.Position = script.Parent.Position
script.Parent:Destroy()
end
script.Parent.ProximityPrompt.Triggered:Connect(explosion)
Inside the tool [LOCAL SCRIPT]
script.Parent.Activated:Connect(function()
local player = game.Players.LocalPlayer
local bomb = script.Parent.Handle:Clone()
bomb.Parent = game.Workspace
bomb.Name = "Bomb"
bomb.CanCollide = true
bomb.Position = script.Parent.Handle.Position
end)
I believe the problem is that you’re cloning a server sided script only on the client (from a local script), so it doesnt exist on the server and therefore cannot run on the server
I would recommend making a ((((safe)))) remote event which spawns the bomb on the server, not on the client
In order to make it safe, make sure they have the tool and add a cooldown so an exploiter cant spam it, or any other safety measures you would think are necessary
1 Like