Hello! My script im about to showcase right now is for my FPS game where it spawns guns from the ServerStorage automatically, however there has been an issue that i cannot use the script on many maps because if i do then too much guns will spawn at the areas i didnt want the guns to be at, heres the script (the map is in serverstorage FYI and this is a normal script in SSService)
function generaterandom()
--[[ local Ops = game.Lighting.Ops
local OpChil = Ops:GetChildren()
local Op1 = Ops.Op1
local Op2 = Ops.Op2
local Op3 = Ops.Op3 ]]--
--Put variables here. You can also replace 'local generate = math.random(1,3)' to 'local generate = math.random(1, #OpChil)'. # means number.
local generate = math.random(1,4)
if generate == 1 then
--Function
local Mod = game.ServerStorage.Guns["AUG A1"]
local clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
elseif generate == 2 then
local Mod = game.ServerStorage.Guns["SCAR - L"]
local clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
elseif generate == 3 then
local Mod = game.ServerStorage.Guns["Honey Badger"]
local clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
else
local Mod = game.ServerStorage.Guns.MP5K
local clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
end
end
generaterandom()
What im trying to figure out is how to configure the script to work on only 1 map instead of all maps since it auto matically spawns when you run the game, (in other words if i put this script for map1 and not map2, im trying to figure out how to make it spawn for map1 only without it spawning when map2 loads into the workspace)
