Automatically Killed when they move

Hello, I’m planning to make a Squid Game and I’m currently working on Green light, Red light. When if Green light you can move and Red light if you move you will be killed but How can I create an automatically killed when its on Red light? I’m a builder, I really don’t know. Thank you!

1 Like
if part.Velocity.Z > 0 and redlight == true then
player.Character.Humanoid.Health = 0
end
1 Like

Its probably better to get the magnitude of Humanoid | Roblox Creator Documentation like so

local redlight = true

wait(4) --To wait for the game to load
while redlight == true do
	for i,v in pairs(game.Players:GetChildren()) do
		if v.Character.Humanoid.MoveDirection.Magnitude > 0 then
			v.Character.Humanoid.Health = 0
		end
	end
	wait()
end

It may not be the most efficient but it works.

1 Like

actually, It has a sound so when Its says “red light” they will be killed when they are moving or “green light” they can move, like the actual squid game series.

Perhaps try runservice.renderstepped in a localscript and check if the players location changed

local players = game:GetService("Players")
local rs = game:GetService("RunService")

rs.RenderStepped:Connect(function() --fires every frame
   if redlight == true then
        --check location and if it changed Players.LocalPlayer.Character.Humanoid.Health = 0
   end
)
2 Likes