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

why is my script not showing up in server storage and server script server when I test?

whenever i seem to test it the script goes away and i cant run the script script type is just script the script is

Numplayers = 1 Minigames = game.ServerStorage.Minigames : getChildren ()

function msg (text) print (text) end

	 function PlayerAdded(Player)
	        local Bool = Instance.new ("BoolValue" , Player)
			Bool.Name = "AFK"
			end
			
function GetPlayers()
local Players = {}
  for i,v in pairs (game.Players:GetChildren()) do
  if v:FindFirstChild ("AFK") and not v .AFK.Value then
         table.insert(Players, v)
		 end
		 end 
		 return players
		 end
		 game.Players.PlayerAdded:connect(PlayerAdded)
			    
	 
	 while true do
	 local Players = GetPlayers()
	 if #Players >= Numplayers then
	 Msg ("There are not enough players, to start the game!")
	 wait (3)
	 Msg ("Choosing a map...")
	 wait (2)
	 local chosen = Minigames [math.random] (1, #Minigames)]
	 local Clone = Chosen = Chosen:Clone()
	 wait (2)
	 Msg ("Minigame chosen! The map is "... chosen.Name..)
	 Clone.Parent = workspace.CurrentMinigame
	 Msg ("Teleporting players to the minigame.")
	 for i,v in pairs (Player) do
	  if v then
	  local Teleport = Clone.Teleports:GetChildren () [math.random(1, #Clone.Teleports:GetChildren)()]
	   v.Charcter:SetPrimaryPartCFrame(Teleport.CFrame * CFrame.new (0, 5 ,0))
	   Teleport:Destroy()
	  end
	 end
	 else
	 Msg ("There are not enough players to start the game!")
	 end
	 wait()
	 end

2 comments

0

GIVE US SCRIPT AND SCRIPT TYPE

0

updated it

1 answer

✓ Accepted answer

When you go into Play Mode in studio, by default you see the client, which doesn't have access to ServerStorage nor ServerScriptService. There's a button to switch between server and client; while looking at the Explorer window while seeing things from the server's perspective you'll be able to see them.

Note that scripts will not run in ServerStorage.

You have a function named msg that just calls print, but you refer to it as Msg -- Lua is case-sensitive, so this will error. If you have the output window open when you run the place you should be able to see any errors or other problems that Roblox encounters with your script.

2 comments

0

yes but the outpot doesnt run the script

0

I don't understand what you mean

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