Whats wrong with this OnChatted script? [Unsolved]
bin = script.Parent
BlastRad = 30
keyword = {"kamikaze", "Boom"} -- Things that will trigger the explosion when said
print("Kamikazi Script Loaded")
function explode(player)
print("exploding player")
character = game.Workspace:findFirstChild(player.Name)
local explosion = Instance.new("Explosion")--Creates The Explosion.
explosion.Position = character.Torso.Position --Where The Explosion Is.
explosion.BlastRadius = BlastRad
explosion.Parent = game.Workspace --It Has To Be Visible Correct?
end
function onChatted(msg, recipient, speaker)
msg = string.lower(msg)
for i=1,#keyword do
if (msg == keyword[i]) then explode(speaker) end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)