Here are the issues:
-Exception while signaling: LoadAnimation requires the Humanoid Object (NickyJ3.Humanoid) to be…(The rest was cut off)
-Workspace.Simulation_Handling:64: attempt to index global ‘ServerStorage’ (a nil value)
Admins = {"NickyJ3"} -- List of usernames that can control the simulation.
Workspace_Model = "Simulation_Bin_W" -- Name of the model containing the sim in the workspace.
ServerStorage_Model = "Simulation_Bin_S" -- Name of sim container in serverstorage.
function CheckAdmin(plr) -- Function to determine if player is listed under "Admins".
local IsAdmin = true -- Set bool to return if player is not an admin
for i = 1, #Admins do -- For each admin on the list, do the following
if plr.Name == Admins[i] then -- If player name equals admin name, then
IsAdmin = false -- The IsAdmin bool becomes true, because the player is an admin
end
end
return IsAdmin -- Returns if the player is an admin or not.
end
function EndSim() -- Clears the current simulation
Workspace[Workspace_Model]:ClearAllChildren() -- Deletes everything in the Workspace model
end
function LoadSim(model) -- Loads the new simulation
local simclone = model:Clone() -- Clones the original
simclone.Parent = Workspace[Workspace_Model] -- Places clone in workspace container
end
if Workspace:FindFirstChild(Workspace_Model) == nil then -- Checking if the place for the sim exists in the Workspace.
local m = Instance.new("Model", Workspace) -- If not, create it
m.Name = Workspace_Model -- Then name it so it can be found
end
if Game.ServerStorage:FindFirstChild(ServerStorage_Model) == nil then --Repeat the process above, only with ServerStorage.
local m = Instance.new("Model", Game.ServerStorage)
m.Name = ServerStorage_Model
end
Game.Players.PlayerAdded:connect(function(player) -- When a new player enters
if CheckAdmin(player) then -- Check if the player is an admin
player.Chatted:connect(function(msg) -- If they are, when they say something,
if string.lower(string.sub(msg, 1, 4)) == "run/" then -- See if they want to run a sim
local new_sim = ServerStorage[ServerStorage_Model]:FindFirstChild(string.lower(string.sub(msg, 5))) -- See if the sim exists
if new_sim ~= nil and new_sim.Name == (string.lower(string.sub(msg, 5))) then -- If it does, confirm and
EndSim() -- End the current simulation
wait(0.2) -- Wait a bit
LoadSim(new_sim) -- Load the new sim
end
end
if string.lower(msg) == "endsim" then -- If admin says endsim
EndSim() -- End the sim
end
end)
end
end)
~Storm~ |