Untitled
local TweenService = game:GetService("TweenService") local npc = script.Parent local humanoid = npc:FindFirstChildOfClass("Humanoid") local npcHRP = npc:FindFirstChild("HumanoidRootPart") local head = npc:FindFirstChild("Head") local eliminedSound = head:FindFirstChild("Player_Eliminated") local greenLightSound = head:FindFirstChild("Green_Light") local redLightSound = head:FindFirstChild("Red_Light") local gameIntroSound = head:FindFirstChild("Game_Intro") local isLooking = false local platformSegura = workspace:FindFirstChild("LIMITE") -- Parte llamada "PlataformaSegura" local goPart = workspace:FindFirstChild("go") -- Parte que activa el juego local gameStarted = false -- Indica si el juego ya ha comenzado -- Verificación de movimiento del jugador local function checkPlayerMovement(player) local character = player.Character if character then local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid then humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function() if humanoid.MoveDirection.Magnitude > 0 and isLooking and gameStarted then print("El jugador se movió") -- Eliminar al jugador si se mueve durante Red Light humanoid:TakeDamage(humanoid.Health) print("El jugador fue eliminado") if eliminedSound then eliminedSound:Play() script.Parent.Head.GunShotSound:Play() end end end) humanoid.Died:Connect(function() print("El jugador murió") local head = character:FindFirstChild("Head") if head then local face = head:FindFirstChild("face") or head:FindFirstChildWhichIsA("Decal") if face then face.Texture = "rbxassetid://4841508676" end end local playerBlood = character:FindFirstChild("PlayerBlood") if playerBlood then playerBlood.Enabled = true end end) end end end -- Girar el NPC en función de la dirección local function turnBody(direction) local goal if direction == "back" then goal = {CFrame = npcHRP.CFrame * CFrame.Angles(0, math.pi, 0)} print("Green Light") if greenLightSound then greenLightSound:Play() script.Parent.Head.HeadMove:Play() script.Parent.Head.Green.Enabled = true script.Parent.Head.Red.Enabled = false end elseif direction == "front" then goal = {CFrame = npcHRP.CFrame * CFrame.Angles(0, -math.pi, 0)} print("Red Light!") if redLightSound then redLightSound:Play() script.Parent.Head.HeadMove:Play() script.Parent.Head.Green.Enabled = false script.Parent.Head.Red.Enabled = true end end local tween = TweenService:Create(npcHRP, TweenInfo.new(0.4, Enum.EasingStyle.Back), goal) tween:Play() end -- Mover el NPC para que mire al jugador local function lookAtPlayer() turnBody("front") isLooking = true wait(5) isLooking = false turnBody("back") if greenLightSound then greenLightSound.Ended:Wait() end end -- Equipar el outfit al jugador local function equipOutfit(player) local character = player.Character if character then for _, item in pairs(character:GetChildren()) do if item:IsA("Shirt") or item:IsA("Pants") or item:IsA("Accessory") then item:Destroy() end end local shirt = Instance.new("Shirt", character) shirt.ShirtTemplate = "rbxassetid://7535563425" local pants = Instance.new("Pants", character) pants.PantsTemplate = "rbxassetid://7535567833" end end -- Función para iniciar el juego local function startGame() if gameStarted then return end -- Evitar iniciar el juego más de una vez gameStarted = true if gameIntroSound then gameIntroSound:Play() gameIntroSound.Ended:Wait() end while gameStarted do lookAtPlayer() wait(3) end end -- Activar el juego cuando un jugador pisa la parte "go" if goPart then goPart.Touched:Connect(function(other) if other and other.Parent and other.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(other.Parent) if player and not gameStarted then print("Juego activado por", player.Name) startGame() -- Desactivar el script al iniciar el juego goPart.Touched:Disconnect() end end end) end game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) checkPlayerMovement(player) equipOutfit(player) local playerRagdollScript = script:FindFirstChild("PlayerRagdoll"):Clone() playerRagdollScript.Parent = player.Character local playerDeathEffectScript = script:FindFirstChild("PlayerDeathEffect"):Clone() playerDeathEffectScript.Parent = player.Character local head = character:FindFirstChild("Head") if head then local playerBlood = script:FindFirstChild("PlayerBlood"):Clone() playerBlood.Parent = head end end) end)
Leave a Comment