I was making a script and i couldnt figure out why it wouldnt work can someone help me? [closed]
Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
game.Player.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
Character:WaitForChild("Torso")
Character:SetTorsoCframe(Cframe.new(0,25050,0))
end)
end)
local function GetOreFromId(Id)
for i,Ore in pairs(game.ReplicatedStorage.Ores:GetChildren()) do
if Ore.Id.Value == Id then
return Ore
end
end
local function Gamble(y)
local Lottery = {}
for _,Ore in pairs(game.ReplicatedStorage.Ores:GetChildren()) do
local MaxDepth,MinDepth = (Ore.MaxDepth.Value > 0 and Ore.MaxDepth.Value) or 9999, (Ore.MinDepth.Value > 0 and Ore.MinDepth.Value) or 1
local Range = MaxDepth - MinDepth
local MinDistance = y - MinDepth
local MaxDistance = MaxDepth - y
local MaxRarity, MinRarity = Ore.MaxRarity.Value, Ore.MinRarity.Value
local Chance = math.ceil(((MinDistance/Range) * MinRarity * (MaxDistance/Range) * MaxRarity) /2)
for i=1,Chance do
table.insert(Lottery,Ore.Id.Value)
end
end
local Id = Lottery[math.random(1,#Lottery)]
return GetOreFromId(Id)
end
local function GenerateOre(x,y,z)
local Ore = Gamble(y):Clone()
Ore.Parent = workspace.Mine
Ore.Position = Vector3.new(0 + x*6,25000 + y*(-6) + z*6)
end
math.random(os.time())
for x=1,20 do
for z=1,20 do
GenerateOre(x, 1, z)
end
Closed as Too Broad by User#6546, koolkid8099, and unmiss
This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.
Why was this question closed?