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

How to make a kill block that kills you when you are in a moving object?

I need ideas that can make a kill block that kills you while in a moving object in roblox studio.

I'm sorry if this is not about coding.

2 comments

0

I don't even know what you mean by that

0

He wants to make a moving object that kills you when you touch it.

1 answer

Seems quite easy and simple. Here's the kill script down below;


local part =  script.Parent

for i = 1,500 do
  part.Position = part.Position + Vector3.new(0,0,0.11)
  wait(0.03)

  local function onTouched(hit) -- Touch event
	local humanoid = hit.Parent:findFirstChild("Humanoid") -- Define the variable
	if humanoid~=nil then
		humanoid.Health = humanoid.Health - 100   -- Kill the player when it touches the part..
	end
end

script.Parent.Touched:connect(onTouched) -- Make sure to add this or the touch event won't work..

end


What this script does that it makes the part move and when you touch it, it kills you. You can edit the damage for the player if you would like to. You can do this by going in line 10 and changing the -100 to the damage you want the player to receive..

I really hope this helps you and please up vote and select this answer if it did so! :)

2 comments

0

you can just made humanoid.Health = 0, and it will work with any health

0

I ment that i need a part that kills you when you are in a moving object.

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