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

How to make a bullet?

function onTouched()
	if game.Workspace.BaseShot
end

script.Parent.Touched:connect(onTouched)

How can I make this is that if someone gets hit by BaseShot they get killed?

1 answer

✓ Accepted answer

You should have the script inside every bullet, or else when multiple bullets spawn, it will be messier to deal with all of them and the code would more more difficult. Anyway, put this inside a bullet:

function touch(part)
	if part then
		local human = part.Parent:FindFirstChild("Humanoid") or script.Parent.Parent:FindFirstChild("Humanoid") -- This looks bit strange, so you could shoot hats too
		if human then
			human.Health = 0
		end
		script.Parent:Destroy()
	end
end

script.Parent.Touched:connect(touch)

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