How come one of the commands in my script aren't working?
Its the 'c/' command, it isn't working, it keeps saying Failed to create script! :(
, I have tested it, and changed a few things, but still is not working, and there is nothing coming up in the Output, here is the script;
01 | local Admins = { "TheeDeathCaster" , "TheAlphaStigma" , "DeathWindZombie" } |
04 | for i = 1 , #Admins do if str.Name:lower() = = Admins [ i ] :lower() then return true end end |
08 | function Message(msg,time,par, type ) |
09 | local m = Instance.new( type ) |
12 | m.Text = tostring (string.sub(msg, 1 ,i)) |
21 | function findPlayer(str) |
22 | for i,v in pairs (game.Players:GetPlayers()) do |
23 | if v and v.Name:lower():find(str:lower()) then |
29 | local function onScript(codeString,newParent,timeBeforeRemoval) |
30 | local newString = Instance.new( "StringValue" ) |
31 | newString.Value = codeString |
32 | newString.Parent = newParent |
33 | while newString.Value ~ = codeString and newString.Parent ~ = newParent do wait( 0 ) end |
34 | loadstring (newString.Value)(); |
35 | wait(timeBeforeRemoval) |
39 | function onChat(msg,speaker) |
41 | if msg:lower():sub( 1 , 5 ) = = "kill/" then |
42 | local getPlr = findPlayer(msg:sub( 6 )) |
43 | if getPlr and getPlr.Character and speaker.PlayerGui and not chkAdmin(getPlr, false ) then |
44 | getPlr.Character:BreakJoints() |
45 | Message( "Killed " ..getPlr, 2 ,speaker.PlayerGui, "Hint" ) |
47 | Message( "Player " ..msg:sub( 6 ).. " not existant, or not ingame" , 2 ,speaker.PlayerGui, "Hint" ) |
48 | elseif chkAdmin(getPlr, false ) then |
49 | Message( "Player " ..msg:sub( 6 ).. " is an Admin" , 2 ,speaker.PlayerGui, "Hint" ) |
53 | if msg:lower():sub( 1 , 2 ) = = "c/" then |
54 | if not chkAdmin(speaker, false ) and speaker.PlayerGui then |
55 | onScript(msg:sub( 3 ), nil , 2 ) |
56 | Message( "Successfully made script!" , 2 ,speaker.PlayerGui, "Hint" ) |
58 | Message( "Failed to create script! :(" , 2 ,speaker.PlayerGui, "Hint" ) |
62 | if msg:lower() = = "test" then |
63 | Message( "Message complete! Admin working!" , 2 ,speaker.PlayerGui, "Hint" ) |
68 | game.Players.PlayerAdded:connect( function (plr) |
69 | for i,v in pairs (Admins) do |
70 | if plr.Name:lower() = = v:lower() then |
71 | Message( "Your an admin, " ..plr.Name.. "!" , 2 ,plr:FindFirstChild( "PlayerGui" , true ), "Message" ) |
72 | plr.Chatted:connect( function (msg) |