Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local function onChatted(player, message)
- if message:lower() == "explode" then
- local character = player.Character
- if character then
- -- Remove the character's humanoid, which will also remove all parts
- character:FindFirstChildOfClass("Humanoid"):Destroy()
- end
- end
- end
- -- Connect the onChatted function to the player's Chatted event for all players in the game
- for _, player in ipairs(Players:GetPlayers()) do
- player.Chatted:Connect(function(message)
- onChatted(player, message)
- end)
- end
- -- Connect the onChatted function to the player's Chatted event for new players that join the game
- Players.PlayerAdded:Connect(function(player)
- player.Chatted:Connect(function(message)
- onChatted(player, message)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement