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 » Scripters
Home Search
 

Re: Mining game block generation

Previous Thread :: Next Thread 
bannded223 is not online. bannded223
Joined: 18 Dec 2013
Total Posts: 9
14 Jul 2016 12:35 PM
I need help with a block generation script that generates blocks when you destroy a block like in azure mines, epic mining 2, or the quarry.


Report Abuse
bannded223 is not online. bannded223
Joined: 18 Dec 2013
Total Posts: 9
14 Jul 2016 04:49 PM
:/ no replies


Report Abuse
Ryuzoji is not online. Ryuzoji
Joined: 21 Dec 2015
Total Posts: 937
14 Jul 2016 05:06 PM
:/ wrong forum
Report Abuse
StrongNuclear is not online. StrongNuclear
Joined: 05 Mar 2016
Total Posts: 963
14 Jul 2016 05:21 PM
Do some research don't just ask for something to be handed to you.
Report Abuse
StrongNuclear is not online. StrongNuclear
Joined: 05 Mar 2016
Total Posts: 963
14 Jul 2016 05:24 PM

Search in wiki for while or for loops, then search up how to use vector3 positioning, or preferably cframes.
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
14 Jul 2016 05:39 PM
Mouse.TargetSurface
Mouse.Target
CFraming
A bit of math


#code print("while false do end")
Report Abuse
bannded223 is not online. bannded223
Joined: 18 Dec 2013
Total Posts: 9
14 Jul 2016 05:40 PM
I've been searching this was my last option


Report Abuse
bannded223 is not online. bannded223
Joined: 18 Dec 2013
Total Posts: 9
14 Jul 2016 05:41 PM
Thx RemasteredBox but I am looking for it to generate blocks when I break a block in my game


Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 Jul 2016 06:21 PM
I made that type of game once. It involves a huge array table to hold block data

MineData = {}

function GetBlockXYZ(pos)
if pos.Y < 10007 then
return MineData["X" .. pos.X .. "Y" .. pos.Y .. "Z" .. pos.Z]
else
return 0
end
end

function SetBlockXYZ(pos,val)
MineData["X" .. pos.X .. "Y" .. pos.Y .. "Z" .. pos.Z] = val
end

once you destroy the block I did this

if GetBlockXYZ(block.Position + Vector3.new(0,-7,0)) == nil then
PickBlockType(block.Position + Vector3.new(0,-7,0))
SetBlockXYZ(block.Position + Vector3.new(0,-7,0),1)
end
if GetBlockXYZ(block.Position + Vector3.new(0,7,0)) == nil then
PickBlockType(block.Position + Vector3.new(0,7,0))
SetBlockXYZ( block.Position + Vector3.new(0,7,0),1)
end
if GetBlockXYZ(block.Position + Vector3.new(-7,0,0)) == nil then
PickBlockType(block.Position + Vector3.new(-7,0,0))
SetBlockXYZ(block.Position + Vector3.new(-7,0,0),1)
end
if GetBlockXYZ(block.Position + Vector3.new(7,0,0)) == nil then
PickBlockType(block.Position + Vector3.new(7,0,0))
SetBlockXYZ(block.Position + Vector3.new(7,0,0),1)
end

the PickBlockType is a function that chooses what should spawn there using math.random and it also places a block at that position. the 7 is the size of the block grid I used

I am actually amazed on how much work I did on this game as I thought I abandoned it early into development.


Report Abuse
bannded223 is not online. bannded223
Joined: 18 Dec 2013
Total Posts: 9
14 Jul 2016 06:27 PM
Omg thanks a ton. i'll make sure to try it later!


Report Abuse
bannded223 is not online. bannded223
Joined: 18 Dec 2013
Total Posts: 9
14 Jul 2016 08:53 PM
Alright I can't find my problem I know it's wrong pls don't laugh I am new to scripting, I think everything is right except for the PickBlockType. Here's what I have:


local block = game.workspace.Ores.Stone
MineData = {}

function GetBlockXYZ(pos)
if pos.Y < 10007 then
return MineData["X" .. pos.X .. "Y" .. pos.Y .. "Z" .. pos.Z]
else
return 0
end
end

function SetBlockXYZ(pos,val)
MineData["X" .. pos.X .. "Y" .. pos.Y .. "Z" .. pos.Z] = val
end

function PickBlockType(Stone)
for _ = 1, 10 do
if (math.random(100))> 20 then
PickBlockType = Stone
end
wait(1)
end
end


function onClicked(PlayerWhoClicked)
block:Destroy()
if GetBlockXYZ(block.Position + Vector3.new(0,-7,0)) == nil then
PickBlockType(block.Position + Vector3.new(0,-7,0))
SetBlockXYZ(block.Position + Vector3.new(0,-7,0),1)
end
if GetBlockXYZ(block.Position + Vector3.new(0,7,0)) == nil then
PickBlockType(block.Position + Vector3.new(0,7,0))
SetBlockXYZ( block.Position + Vector3.new(0,7,0),1)
end
if GetBlockXYZ(block.Position + Vector3.new(-7,0,0)) == nil then
PickBlockType(block.Position + Vector3.new(-7,0,0))
SetBlockXYZ(block.Position + Vector3.new(-7,0,0),1)
end
if GetBlockXYZ(block.Position + Vector3.new(7,0,0)) == nil then
PickBlockType(block.Position + Vector3.new(7,0,0))
SetBlockXYZ(block.Position + Vector3.new(7,0,0),1)
end
end

game.workspace.Ores.Stone.ClickDetector.MouseClick:connect(onClicked)



Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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