Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

The player doesn't die?

Asked by 10 years ago
local Peeps = ("DeveloperAtWork")


local FRIEND = Instance.new("Part")
FRIEND.Parent = game.Workspace[Peeps]
FRIEND.Anchored = true 
FRIEND.CanCollide = false
local Fig = Instance.new("SpecialMesh", FRIEND)
Fig.MeshType = "FileMesh"
Fig.MeshId = "http://www.roblox.com/asset/?id=132920664"
Fig.TextureId = "http://www.roblox.com/asset/?id=132920685"
Fig.Scale = Vector3.new(3,3,3)

FRIEND_CFRAME = game.Workspace[Peeps].Head  --Its Position 
while true do
    wait()
    FRIEND.CFrame = FRIEND_CFRAME.CFrame+Vector3.new(2.3,2.3,0)
end



function isPlayerAdmin(name)
   for i,v in pairs(Peeps) do
      if string.lower(name) == string.lower(v) then
         return true
      end
   end
end 
function chatted(msg,rec)
   if (string.sub(msg,1,5):lower()) == "kill/" then
      local player = game.Players:FindFirstChild(string.sub(msg,6))
      if player then
         if player.Character then
            Player.Character.Humanoid.Health = 0
         end
      end
   end
end

idk how to fix it ;/

3 answers

Log in to vote
6
Answered by
Merely 2122 Moderation Voter Community Moderator
10 years ago

The script is never going to escape from the infinite loop on line 15.

On line 23, you're treating the Peeps variable as if it were a table, but it's actually a string. At multiple points in the script, you make the assumption that Workspace[Peeps] actually exists, when it may not.

On line 34, you refer to "Player", which is an undefined variable, so it's going to throw an error when you attempt to index Character. It should be lowercase.

And as Hippalectryon mentioned, you never hooked up the Player.Chatted event to your "chatted" function.

Ad
Log in to vote
1
Answered by 10 years ago

You never launch the chatted function in this script

Log in to vote
1
Answered by 10 years ago

I'm going to add one point to the above answers. I would see the easiest & most efficient way of developing the commands to be String Patterns. If you would like to look up string patterns; I have a couple of links here: ROBLOX Wiki LuaLearners ROBLOX Forum I added the ROBLOX forum one as that was the one that helped me most, my friend gave me that when I was a beginner and that's how I learned the background of string patterns. The LuaLearners tutorial is pretty detailed and the ROBLOX wiki is a good way to figure out what some specific patterns mean. I hope this helped you and anyone else aiming to get experience with commands.

Answer this question