Ok this is how to play, you rate the script above you from 1 to 10, 10 being the best, then you post your own script! Ill start it:
bin = script.Parent
tool = script.Parent
player = tool.Parent.Parent
seedType = "Bomb"
seedsLeft = bin.seedsLeft
tool.Name = seedType.. " (".. tostring(seedsLeft.Value).. ")"
seed = game.Lighting:findFirstChild(seedType):clone()
function getOwner(ownedObject)
local ob = ownedObject
local maxDepth = 10
local depth = 0
while ob.Name ~= "Factory" do
ob = ob.Parent
depth = depth + 1
if depth > maxDepth then
print("Maximum Depth Exceded")
return ""
end
if ob == game.Workspace then
print("Owner Not Found")
return ""
end
end
return ob.OwnerName.Value
end
function click(mouse)
local targ = mouse.Target
local pos = mouse.Hit.p
if targ.Name == "ground" then
if getOwner(targ) == player.Name then
local useable = targ:findFirstChild("useable")
if useable ~= nil then
if useable.Value == true then
useable.Value = false
local s = seed:clone()
s.Position = targ.Position + Vector3.new(0, 1, 0)
s.Parent = targ.Parent
seedsLeft.Value = seedsLeft.Value - 1
tool.Name = seedType.. " (".. tostring(seedsLeft.Value).. ")"
local creator = s:findFirstChild("creator")
if creator ~= nil then
if creator.className == "StringValue" then
creator.Value = player.Name
elseif creator.className == "ObjectValue" then
creator.Value = player
end
end
local soil = s:findFirstChild("soil")
if soil ~= nil then
if soil.className == "ObjectValue" then
soil.Value = targ
end
end
end
end
end
end
print(seedsLeft.Value)
if seedsLeft.Value == 0 then
script.Parent:remove()
end
end
function keyDown(key)
key = string.lower(key)
end
function onSelected(mouse)
mouse.Button1Down:connect(function () click(mouse) end)
mouse.KeyDown:connect(keyDown)
end
tool.Selected:connect(onSelected) |