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

My Time Bomb is not working as intended Help?

I am using the pre made time bomb roblox has to offer us, I am modifying it so the owner is not able to kill himself. However it is not working as intended, when I test this out yes the owner doesn't have its limbs blown out or is killed but neither is anybody else. How could I make it where only the owner is safe from the explosion?


local Tool = script.Parent
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)

function blowUp()
	
	
	local sound = Instance.new("Sound")
		sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
		sound.Parent = script.Parent
		sound.Volume = 1
		sound:play()
	explosion = Instance.new("Explosion")
	explosion.BlastRadius = 12
	explosion.BlastPressure = 1000000 
	explosion.DestroyJointRadiusPercent = 0
	explosion.Hit:Connect(function(part, distance)
		local hum = part.Parent:FindFirstChild("Humanoid")
		if hum ~= vPlayer.Humanoid then
			hum:TakeDamage(100)
			explosion.DestroyJointRadiusPercent = .5
		end
	end)

2 comments

0

OMG....

0

what is this bad code

1 answer

Look on line 2, you are defining that the owner is the tools parent, which is the local player. But since you are not adding any arguments it assumes that everybody has a player, replace it by doing an if else statement checking the player id.

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