SirGelatina Site Admin
Joined: 01 Mar 2008 Posts: 116 Location: Behind you
|
Posted: Sun May 25, 2008 6:56 pm Post subject: |
|
|
Take a little time to make it
Code: | cycles = false -- Leaving as it is, will make it run once. Else, will run in cycles
pause = 10 -- If cycles is true, how long will be the pause between cycles ?
minGoldDropped = 3 -- How many golds will it drop ( At minimum ) ?
maxGoldDropped = 10 -- How many golds will it drop ( At maximum ) ?
goldGiven = 100 -- How much gold will be given for the head ?
basePlatePos = game.Workspace.PrimaryPart.Position
basePlateSize = game.Workspace.PrimaryPart.Size
gold = Instance.new("Part")
gold.BrickColor = BrickColor.new("Bright yellow")
gold.formFactor = 0
gold.Size = Vector3.new(3, 3, 3)
gold.Reflectance = 0.3
scr = Instance.new("Script")
scr.Source = ( "goldGiven = " .. goldGiven .. [[
debounce = false
function onTouched(Toucher)
local head = Toucher.Parent:findFirstChild("Head")
if head ~= nil and debounce == false then
local gold = head:findFirstChild("Gold")
if gold ~= nil and then
debounce = true
gold.Value = gold.Value + goldGiven
script.Parent:remove()
end
end
end
script.Parent.Touched:connect(onTouched) ]] )
scr.Parent = script
function randomizePos()
local x = basePlatePos.x + math.random(-1 * (basePlateSize.x / 2), basePlateSize.x / 2)
local y = basePlatePos.y + math.random(50, 150)
local z = basePlatePos.z + math.random(-1 * (basePlateSize.z / 2), basePlateSize.z / 2)
return Vector3.new(x, y, z)
end
while true do
local amount = math.random(minGoldDropped, maxGoldDropped)
for x=1, amount do
local drop = gold:clone()
drop.Position = randomizePos()
drop.Parent = game.Workspace
end
if cycles == false then break end
wait(pause)
end |
|
|