Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

suicide script for certain player only? (redone)

so i wanted to make a script that kills the chatter whenever he or she said a specific thing if they were a specific person say for example, Player 1 said pwnt then player 2 said pwnt, then player 3 but then only player 1 would get killed because he was a specific person who chatted something very specific but it wont work, at least not properly.

function onChatted(msg, speaker)
local source = string.lower(speaker.Name)
local msg = string.lower(msg)
local playr = game.Players.LocalPlayer
local ad = playr:GetFullName()

if msg == "get rekt" then
if ad == "Player1, Player2, Player 3" then
    speaker.Character.Head:remove() -- 
end end
end

function onPlayerEntered(newPlayer)
 newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) 
end) end

game.Players.ChildAdded:connect(onPlayerEntered)

function onChatted(msg, speaker) end

1 answer

This is a local script in StarterGui

function onChatted(msg, speaker)
local source = string.lower(speaker.Name)
local msg = string.lower(msg)
local player = game.Players.LocalPlayer
local ad = player:GetFullName()

if msg == "get rekt" then
if ad == "Player1" then --you only need to put player1
    speaker.Character.Head:remove() -- 
end end
end

function onPlayerEntered(newPlayer)
 newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) 
end) end

game.Players.ChildAdded:connect(onPlayerEntered)

function onChatted(msg, speaker) end

This should fix it!

1 comment

0

didnt fix D: is it a local script or server script

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