i wanna make a game like nds! how do i make?
Thank you!
-MasterAtTheWings
show me what is this lol
Thank you!
-MasterAtTheWings
(im pretty tired at this moment lol)
Yes, I shall.
The best way to make games, such as Natural Disaster Survival, is to put a few things in mind.
- An Intermission, and Disaster/Map Choosing System.
- Points and Wins.
With this in mind. I’m not just going to throw you in the ditch, beat you up and leave you to rot. Here is a basic script to get you started. Let’s create a few things.
- Folder named “Maps” in ServerStorage.
- Folder named “PrevMaps” in ServerStorage.
- Folder named “Disasters” in ServerStorage.
- Folder named “PrevDisasters” in ServerStorage.
Now when making maps make sure all parts are Modeled. Then create a folder in the model, and name it “Spawns”. And insert parts on the floor around your map. This is where players will teleport to.
Now the code. Put this in ServerScriptService
--// This is all the Leaderboard stuff for the Tab Menu.
local Storage = game:GetService("DataStoreService"):GetDataStore("Fardaroonie_1") -- Create a Datastore, cloud object.
game.Players.PlayerAdded:Connect(function(plr) --// Runs every time a player joins, with the player object included.
local leaderstats = Instance.new("Configuration") -- Lets create our Leaderstats folder
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr -- Puts the folder in our player object.
local Wins = Instance.new("IntValue") -- Heres just a value so we can display in the Tab Menu.
Wins.Name = "Wins"
Wins.Parent = leaderstats
Wins.Value = Storage:GetAsync(plr.UserId.."_Wins") or 0 -- Set our Wins to either be something saved in the cloud or 0 if it has never been saved.
end)
game.Players.PlayerRemoving:Connect(function(plr) --// Runs every time a player is leaving, with player object included.
Storage:SetAsync(plr.UserId.."_Wins",plr:FindFirstChild("leaderstats").Wins.Value) -- Save our wins value in the cloud.
end)
--// Now for our game
while true do
task.wait(1)
for i=30,0,-1 do -- This is for intermission, start at 5, until it reaches 0, and tick the number down by 1 each second.
print(i) -- Prints the currently timer value.
task.wait(1)
end
-- If our Maps or Disasters folder is empty. Let's just bring back everything from the Previous folders.
for i,v in pairs(game.ServerStorage.PrevMaps:GetChildren()) do
v.Parent = game.ServerStorage.Maps
end
for i,v in pairs(game.ServerStorage.PrevDisasters:GetChildren()) do
v.Parent = game.ServerStorage.Disasters
end
-- Now lets get a random map
local RandomMap = game.ServerStorage.Maps:GetChildren()[math.random(1,#game.ServerStorage.Maps:GetChildren())] -- Get children returns a Table full of every object in that directory. We could just get a random object, from the first object to the amount of objects in the directory.
local RandomDisaster = game.ServerStorage.Disasters:GetChildren()[math.random(1,#game.ServerStorage.Disasters:GetChildren())] -- Works the same way
-- Let's clone our objects, so that we never use the original map or model.
local RMClone = RandomMap:Clone()
local RDClone = RandomDisaster:Clone()
-- This is so we don't ever get the same map or disaster.
RandomMap.Parent = game.ServerStorage.PrevMaps
RandomDisaster.Parent = game.ServerStorage.PrevDisasters
-- Put our map on the game, and teleport our players to the spawns.
RMClone.Parent = workspace
for i,v in pairs(game.Players:GetChildren()) do
local RandomSpawn = RMClone:FindFirstChild("Spawns"):GetChildren()[math.random(1,#RMClone:FindFirstChild("Spawns"):GetChildren())]
v.Character:SetPivot(RandomSpawn.CFrame)
local WonRound = Instance.new("BoolValue")
WonRound.Name = "Alive"
WonRound.Parent = v.Character
end
-- Wait 5 seconds before disaster strikes
task.wait(5)
-- UH OH. DISASTUH!!!
RDClone.Parent = workspace
-- Now we wait in an intermission for the disaster to end.
for i=30,0,-1 do
task.wait()
end
-- Destroy the cloned disaster, and then wait a few seconds then reload everyone.
RDClone:Destroy()
task.wait(3)
for i,v in pairs(game.Players:GetChildren()) do
if v.Character:FindFirstChild("Alive") then
v.leaderstats.Wins.Value += 1 -- Give them a win if they lived.
end
v:LoadCharacter()
end
end
i will do this, and if work, i will mark the reply as solution.
Thank you!
-MasterAtTheWIngs
If you believe this has been solved. Make sure you make my comments the solution. Not only it avoids further spam and emails, but it will also help me. Thanks!