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 you are in a moving object in roblox studio. When I am in a moving veical, the my part that kill be does not work.

I'm sorry if this is not about coding.

2 comments

0

This is not a request site. Please provide some attempt of this.

0

I'm sorry but i really need help.

2 answers

Very easy.

local Humanoid = Instance.new("Humanoid")
while wait() do
	if Humanoid.MoveDirection.Magnitude > 0 then
		Humanoid.Health = 0
	end
end

When they move they get killed.

OR

local Humanoid = Instance.new("Humanoid")
local HumanoidRootPart = Instance.new("Part")
HumanoidRootPart.Touched:Connect()
	if Part.Anchored == false then
		Humanoid.Health = 0
	end
end

make a part first in the workspace if you want to create it using script, then use this code

local part = Instance.new("Part")
part.Parent = game.Workspace
part.Position = --Desired position
--e.g you could do "part.Position = game.Workspace.Car.Seat.Position"

Then you need to create a script that when it is touched it sets the player's health to zero. So to do this you need to do

part.Touched:Connect(function(plr)
	if plr.Parent:FindFirstChild("Humanoid") then --This is looking for a HumanoidRootPart to see if it is a roblox character
		plr.Parent:FindFirstChild("Humanoid").Health = 0 --This is setting the health of the HumanoidRootPart (the main part of the character) to zero
	end
end)

Hope this helped

1 comment

0

kingblaze_1000 don't just ask for the Humanoid use plr.Parent:FindFirstChildOfClass("Humanoid")

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