RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"when lecutio is said the person will lose 10 health every 2 seconds until they say stop"
-- server script local chatService = game:GetService("Chat") local function onChat(player, message) if message:lower() == "lecution" then local playerCharacter = player.Character local playerHumanoid = playerCharacter:FindFirstChild("Humanoid") local function loseHealth() if playerHumanoid.Health > 0 then playerHumanoid.Health = playerHumanoid.Health - 10 end end local loseHealthLoop = game:GetService("RunService").Heartbeat:Connect(loseHealth) local function onStop(_, stopMessage) if stopMessage:lower() == "stop" then loseHealthLoop:Disconnect() chatService:RemoveMessageReceiver(player.UserId) end end chatService:RegisterMessageReceiver(player.UserId, onStop) end end chatService:RegisterChatCallback(Enum.ChatCallbackType.OnNewMessage, onChat)