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

"attempt to call a userdata value" Help please?

Everytimes i touch my bomb, the output says : 18:34:38.972 - attempt to call a userdata value

Here is the code :

function Bomb(part)
	if part.Parent:FindFirstChild("Humanoid") then
		local BB = Instance.new("Explosion")
		BB.ExplosionType = Enum.ExplosionType.CratersAndDebris
		BB.Parent = workspace
		BB.BlastRadius = 20
		BB.Position = Vector3.new(Bomb.Position)
		BB.BlastPressure = 500000
		BB.Name = "Explosion, Bomb"
		BB.DestroyJointRadiusPercent = 0
	end
end
Bomb = game.Workspace.Bomb
Bomb.Touched:connect(Bomb)

4 comments

0

Try parenting the explosion to the bomb.

0

But the explosion would appear at random times, i'm trying to make it explode once you touch it.. Like when i place an explosion in the workspace, the explosion restarts at random moments

0

What line does it say there is an error on?

0

It's not showing any line where there is an error

1 answer

✓ Accepted answer
function Bomb(part)
    if part.Parent:FindFirstChild("Humanoid") then
        local BB = Instance.new("Explosion")
        BB.ExplosionType = Enum.ExplosionType.CratersAndDebris
        BB.Parent = workspace
        BB.BlastRadius = 20
        BB.Position = part.Position
        BB.BlastPressure = 500000
        BB.Name = "Explosion, Bomb"
        BB.DestroyJointRadiusPercent = 0
    end
end

game.Workspace.Bomb.Touched:connect(Bomb)

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