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

My friend made me a custom script?

But when I try to change 'run/' it doesn't work when I change it?

current_map = nil

names = {"iSidersz"}

game.Players.PlayerAdded:connect(function(player)
 for i, v in pairs(names) do
  if v == player.Name then 
   player.Chatted:connect(function(chatmsg)
    if chatmsg:sub(1,4) == "run/" then
     local map = chatmsg:sub(5, chatmsg:len())
     if game.Lighting:FindFirstChild(map) then
      if current_map ~= nil then
       current_map.Parent = game.Lighting
      end
      game.Lighting[map].Parent = game.Workspace
      current_map = game.Workspace[map]
     end
    end
   end)
  end
 end
end)

1 comment

0

For once, not our problem. Bug your friend and ask him about your setup.

1 answer

✓ Accepted answer

Let's look at the code. This line here:

if chatmsg:sub(1,4) == "run/" then

It's checking if the first 4 characters of the chatmsg string are equal to "run/". What you are probably doing when you edit the script is you are changing "run/" to something longer than 4 characters. In that case, you need to update the 4 to the length of the string. The same goes for the 5 in the next line.

A clearer way to do this:

if chatmsg:sub(1, string.len("run/")) == "run/" then
   local map = chatmsg:sub(string.len("run/")+1, chatmsg:len())

2 comments

0

Ik im stupid for asking this but I have to change run/ to my command right? if so which ones :3

0

Nvm I figured it out thx merely

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