generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Admin

Previous Thread :: Next Thread 
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
07 May 2014 12:58 PM
Here is my script, i want it so when an admin types map/(MAPNAME) it will change to that map. Here is my script
admins = {"yobo89", "Player1"}

function isPlayerAdmin(name)
for i,v in pairs(admins) do
if name == v then
return true
end
end
return false
end

function chatted(msg, recpt)
if string.sub(msg, 1, 4) == "map/" then
local map = game.ServerStorage.Maps:FindFirstChild(string.sub(msg, 5))
if map then
CurrentMap = yobo89
end
end
end



function playerAdded(newPlayer)
if isPlayerAdmin(newPlayer.Name) then
newPlayer.Chatted:connect(chatted)
else
print("Player Is Not Admin")
end
end

game.Players.PlayerAdded:connect(playerAdded)

-----------------------------------------------------------

local Maps = {}

for _, Map in pairs (Game.ServerStorage.Maps:GetChildren()) do
table.insert(Maps, Map:Clone())
end

Game.ServerStorage.Maps:Destroy()

local LastMap
while wait() do
local Map
repeat
Map=Maps[math.random(#Maps)]
until Map~=LastMap
LastMap=Map

m = Instance.new("Message",game.Workspace)
for i,v in pairs(game.Players:GetChildren()) do
Instance.new("ForceField", v.Character)
end
wait(10)
CurrentMap = Map:Clone()
m.Text = ("The following map was made by " .. CurrentMap.Name)
wait(3)
m:Destroy()
CurrentMap.Parent = game.Workspace
CurrentMap:MakeJoints()
CurrentMap:MoveTo(Vector3.new(-172.5, 3, 121.5))


target = CFrame.new(-172.5, 17, 121.5) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
--add an offset of 5 for each character
end


wait(300) -- 5 minutes
target = CFrame.new(-143, 90, 118.5) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
--add an offset of 5 for each character
end
CurrentMap:Destroy()

end
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
07 May 2014 01:01 PM
Where it says "CurrentMap = yobo89" it should say CurrentMap = map
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
07 May 2014 02:25 PM
@b1
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
07 May 2014 02:32 PM
@b2
Report Abuse
Azarth is not online. Azarth
Joined: 17 Aug 2012
Total Posts: 2760
07 May 2014 02:49 PM
local folder = game.ReplicatedStorage:WaitForChild("Maps")
local admins = {azarth = true, player1 = true, yobo89 = true}



local function return_map(msg)
for a,b in pairs(folder:GetChildren()) do
local map = string.find(b.Name:lower(),msg)
if map then
return b
end
end
end

game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
if admins[plr.Name:lower()] then
local map = return_map(msg:lower())
if map then
map:Clone().Parent = Workspace
end
end
end)
end)


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image