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 » Scripting Helpers
Home Search
 

Re: What's wrong with it, and how to fix it?

Previous Thread :: Next Thread 
AZombieSurvivalist1 is not online. AZombieSurvivalist1
Joined: 07 Dec 2012
Total Posts: 17
05 Aug 2013 04:07 PM
This is for my Craft tool in my game. It worked for a bit, until I added some stuff to the game and this script.


dwait(3)

local TOOL = script.Parent

local SCREEN_GUI = TOOL.ScreenGui
local FRAME = SCREEN_GUI.Frame

--BUTTONS
local CLEAR_BUTTON = FRAME.ClearButton
local ITEM_BUTTON = FRAME.ItemButton
local PROCESS_BUTTON = FRAME.ProcessButton
local TOOL_BUTTON = FRAME.ToolButton

--LABELS
local ALERT_LABEL = FRAME.AlertLabel
local LIST_LABEL = FRAME.ListLabel
local TARGET_LABEL = FRAME.TargetLabel

--OTHER
local RANGE = 15
local SERVICES = game.Workspace.Services

--MAIN STUFF
local SELECTED = {}
local CHOOSING = false

--INGREDIENT TABLES
local TOOL_TABLE = {

{

{"Large Wood", "Large Wood", "Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall","Wall","Wall", "Wall", "Wall", "Wall", "Glass", "Glass", "Glass", "Glass", "Glass", "Glass", ""},
"Small Skyscraper"
},

{

{"Large Wood", "Large Wood", "Large Wood", "Large Wood", "Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Glass", "Glass", "Glass", "Glass", "Glass", "Glass", ""},
"Mansion"
},


{

{"Wall", "Wall", "Wall", "Med Foliage", "Small Foliage", ""},
"2 Story Hut"
},

{

{"Med Rock", "Med Rock", "Wall", "Med Foliage", "Small Foliage", ""},
"2 Story Stone Hut"
},

{

{"Wall", "Wall", "Wall", "Wall", "Med Foliage", "Med Foliage", ""},
"Small House"
},

{

{"Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Large Foliage", "Med Foliage", ""},
"Med House"
},

{

{"Large Wood", "Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Wall", "Large Foliage", "Med Foliage", "Glass", "Glass", ""},
"2 Story House"
},

{

{"Red Stone", "Orange Stone", "Yellow Stone", "Green Stone", "Blue Stone", "Indigo Stone", "Violet Stone", "Steam Engine", ""},
"Rainbow Steam Ship"
},

{
{"Red Stone", "Orange Stone", "Yellow Stone", "Green Stone", "Blue Stone", "Indigo Stone", "Violet Stone",""},
"The Rainbow Ship"
},

{
{"Small Handle", ""},
{"Crude Club", "Hunting Club"}
},

{
{"Wall", "Wall", "Med Foliage", ""},
"Crude Hut"
},


{
{"Med Rock", "Med Rock", "Med Wood", ""},
"Well"
},

{
{"Wall", "Wall", "Large Foliage", ""},
{"Large Hut Center", "Large Hut Edge", "Large Hut Door", "Large Hut Corner"}
},

{
{"Med Rock", "Med Rock", "Wall", ""},
{"M. Home Center", "M. Home Corner", "M. Home Edge", "M. Home Door", "M. Home Stairs", "Mine"}
},

{
{"Stone Brick", "Stone Brick", "Stone Brick", "Wall", "Glass", "Glass", ""},
{"Ren. Home Center", "Ren. Home Corner", "Ren. Home Edge", "Ren. Home Door", "Ren. Home Stairs", "Tailor's Shop", "Large Mine"}
},

{
{"Med Rock", "Med Rock", ""},
"Medieval Wall"
},

{
{"Med Rock", "Med Rock", "Med Rock", ""},
{"M. Wall Corner", "Ren. Wall"}
},

{
{"Med Rock", "Med Rock", "Med Rock", "Med Rock", ""},
"Medieval Tower"
},

{
{"Med Rock", "Med Rock", "Med Rock", "Med Rock", "Med Rock", "Wall", "Wall", ""},
"Medieval Gate"
},

{
{"Plank", "Plank", "Steel", "Steel", ""},
"Throne Room (1x1)"
},

{
{"Plank", "Plank", "Plank", "Plank", ""},
"Dining Room (1x2)"
},

{
{"Plank", "Plank", "Cloth Bolt", "Cloth Bolt", ""},
"Bedroom (1x1)"
},

{
{"Plank", "Plank", ""},
{"Bookshelf (1x1)", "Table (1x1)", "Chest"}
},

{
{"Med Rock", "Med Rock", "Med Rock", "Wall", "Iron", "Iron", ""},
"Forge"
},

{
{"Large Wood", "Large Wood", "Med Rock", ""},
"Medieval Granary"
},

{
{"Wall", "Wall", "Wall", "Wall", "Med Wood", "Med Wood", "Iron", "Iron", ""},
"Lumbermill"
},

{
{"Small Rock", "Small Rock", ""},
"Flint"
},

{
{"Hull", ""},
"Raft"
},

{
{"Hull", "Med Wood", "Hemp", "Hemp", ""},
"Sailboat"
},

{
{"Hull", "Hull", "Med Wood", "Hemp", "Hemp", "Hemp", ""},
"Schooner"
},

{
{"Hull", "Hull", "Hull", "Hull", "Large Wood", "Hemp", "Hemp", "Hemp", "Hemp", ""},
"Galleon"
},

{
{"Hull", "Hull", "Hull", "Hull", "Large Wood", "Steam Engine", ""},
"Steam Ship"
},

{
{"Small Wood", "Rope", ""},
"Crude Bucket"
},

{
{"Wall", "Wall", "Med Rock", ""},
"Crude Granary"
},

{
{"Small Handle", "Copper", "Copper", ""},
{"Copper Axe", "Copper Pickaxe"}
},

{
{"Small Handle", "Iron", "Iron", ""},
{"Iron Axe", "Iron Pickaxe"}
},

{
{"Small Handle", "Rope", ""},
{"Crude Bow", "Crude Fishing Rod"}
},

{
{"Crafted Handle", "String", ""},
{"Longbow", "Shortbow", "Bow", "Hunting Bow", "Fishing Rod"}
},

{
{"Crafted Handle", "String", "Steel", ""},
{"Crossbow", "Arbalest"}
},

{
{"Small Handle", "Steel", "Steel", ""},
{"Steel Axe", "Steel Pickaxe"}
},

{
{"Steel", "Steel", "Rope", ""},
"Bucket"
},

{
{"Small Handle", "Steel", ""},
"Crafting Knife"
},

{
{"Small Handle", "Copper", ""},
"Skinning Knife"
},

{
{"Crafted Handle", "Steel", "Steel", ""},
{"Lumber Saw", "Sledgehammer", "Masonry Hammer", "Blunderbuss"}
},

{
{"Small Rock", "Small Rock", "Steel", ""},
"Flint & Steel"
},

{
{"Coal", ""},
"Dye: Black"
},

{
{"Berry", ""},
"Dye: Purple"
},

{
{"Hemp Stalk", ""},
"Dye: Green"
},

{
{"Blue Flower", ""},
"Dye: Blue"
},

{
{"Red Flower", ""},
"Dye: Red"
},

{
{"Copper", ""},
"Crude Lockpick"
},

{
{"Iron", ""},
"Lockpick"
},

{
{"Steel", ""},
"Strong Lockpick"
},

{
{"Wall", "Wall", ""},
{"Palisade Wall", "Palisade Tower"}
}

} --TOOL TABLE END

local ITEM_TABLE = {

{
{"Med Wood",""},
"Med. Flagpole"
},

{
{"Steel", "Oil", ""},
"Pipe"
},

{
{"Pipe", "Pipe", "Steel", "Oil", "Coal", ""},
"Steam Engine"
},

{
{"Small Wood", ""},
{"Small Handle", "Wooden Seat"}
},

{
{"Med Wood", "Med Wood", ""},
{"Wall", "Hull"}
},

{
{"Large Wood", ""},
{"Wall", "Hull"}
},

{
{"Plank", "Plank", ""},
"Wall"
},

{
{"Hemp Stalk", "Hemp Stalk", ""},
"Fresh Hemp"
},

{
{"Hemp"},
"Rope"
},

{
{"Hemp", "Hemp"},
{"Hempen Shirt", "Hempen Pants"}
},

{
{"Leather", "Leather"},
"Leather Armor"
},

{
{"Fox Fur", "Fux Fur"},
"Fur Armor"
},

{
{"Leather", "Copper", "Copper"},
"Copper Armor"
},

{
{"Leather", "Iron", "Iron"},
"Iron Armor"
},

{
{"Leather", "Steel", "Steel"},
"Steel Armor"
},

{
{"Dough"},
"Bread Dough"
},

{
{"Small Handle", "Small Rock"},
"Arrow"
},

{
{"Small Handle", "Copper"},
"Copper Arrow"
},

{
{"Small Handle", "Iron"},
"Iron Arrow"
},

{
{"Small Handle", "Steel"},
"Steel Arrow"
},

{
{"Steel"},
"Bolt"
},

{
{"Small Compost"},
"Dirt Road"
},

{
{"Med Rock"},
"Paved Road"
},

{
{"Coal", "Sulfur"},
"Gunpowder"
},

{
{"Steel", "Gunpowder"},
"Bullet"
},

{
{"Cloth Bolt", "Cloth Bolt"},
{"Cloth Shirt", "Cloth Pants", "Cloth Vest"}
}

} --ITEM TABLE END

local PROCESS_TABLE = {

{
{"Fresh Hemp", ""},
"Began drying...",
function()
processTimedNameChange(SELECTED[1], "Drying Hemp", "Dark green", 30, "Hemp", "Brown")
end
},

{
{"Foxhide", ""},
"Began seperating...",
function()
processTimedNameChange(SELECTED[1], "Seperating Foxhide", "Neon orange", 30, "Fox Fur", "Neon orange")
end
},

{
{"Deerhide", ""},
"Began tanning...",
function()
processTimedNameChange(SELECTED[1], "Tanning Deerhide", "Brown", 30, "Leather", "Reddish brown")
end
},

{
{"Small Foliage", ""},
"Began composting...",
function()
processTimedCompost(SELECTED[1], "Rotting Leaves", "Small Compost", 30)
end
},

{
{"Med Foliage", ""},
"Began composting...",
function()
processTimedCompost(SELECTED[1], "Rotting Leaves", "Med Compost", 30)
end
},

{
{"Large Foliage", ""},
"Began composting...",
function()
processTimedCompost(SELECTED[1], "Rotting Leaves", "Fertile Compost", 30)
end
},

{
{"Berry", "Small Compost", ""},
"Planted berry...",
function()
processTimedFarming(SELECTED[1], SELECTED[2], 30)
end
},

{
{"Wheat", "Med Compost", ""},
"Planted wheat...",
function()
processTimedFarming(SELECTED[1], SELECTED[2], 50)
end
},

{
{"Hemp Stalk", "Med Compost", ""},
"Planted hemp...",
function()
processTimedFarming(SELECTED[1], SELECTED[2], 40)
end
},

{
{"Apple", "Fertile Compost", ""},
"Planted apple...",
function()
processTimedFarming(SELECTED[1], SELECTED[2], 60)
end
}

} --PROCESS TABLE END

--PROCESSING FUNCTIONS

function processTimedNameChange(part, nameA, colorA, time, nameB, colorB)
local partVal = createValue("Object", part.Name, part)

local nameAVal = createValue("String", "NameA", nameA)
local nameBVal = createValue("String", "NameB", nameB)
local colorAVal = createValue("BrickColor", "ColorA", getBC(colorA))
local colorBVal = createValue("BrickColor", "ColorB", getBC(colorB))
local timeVal = createValue("Number", "Time", time)

nameAVal.Parent = partVal
nameBVal.Parent = partVal
colorAVal.Parent = partVal
colorBVal.Parent = partVal
timeVal.Parent = partVal

partVal.Parent = SERVICES.TimedNameChange
end

function processTimedCompost(part, rotName, finName, time)
local partVal = createValue("Object", part.Name, part)

local rotNameVal = createValue("String", "RotName", rotName)
local nameVal = createValue("String", "FinName", finName)
local timeVal = createValue("Number", "Time", time)

rotNameVal.Parent = partVal
nameVal.Parent = partVal
timeVal.Parent = partVal

partVal.Parent = SERVICES.TimedCompost
end

function processTimedFarming(part, compost, time)
local partVal = createValue("Object", part.Name, part)

local compostVal = createValue("Object", "Compost", compost)
local timeVal = createValue("Number", "Time", time)

compostVal.Parent = partVal
timeVal.Parent = partVal

partVal.Parent = SERVICES.TimedFarming
end

function createValue(type, name, value)
local newVal = Instance.new(type.."Value")
newVal.Name = name
newVal.Value = value

return newVal
end

function getBC(string)
return BrickColor.new(string)
end

--MAIN FUNCTIONS
function updateList()
local string = ""

for index, child in pairs(SELECTED) do
if index ~= 1 then
string = string..", "
end

string = string..child.Name
end

LIST_LABEL.Text = string
end

function getIngName(index)
local part = SELECTED[index]

if part == nil then
return ""
else
return part.Name
end
end

function runIngredients(tab, process)
if process == nil then
process = false
end

local required = tab[1]
local made = tab[2]
local func = tab[3]

if #SELECTED < 1 then
return nil
end

for index, child in pairs(required) do
if getIngName(index) ~= child then
return nil
end
end

if process then
return made, func
else
return made
end
end

function alert(text)
ALERT_LABEL.Text = ""
wait(0.1)
ALERT_LABEL.Text = text
end

function getPC()
local player = TOOL.Parent.Parent
local char = player.Character

return player, char
end

function lockCheck(part)
return not part.Locked
end

function distanceCheck(part)
local player, char = getPC()
local head = char.Head
local dist = (head.Position - part.Position).magnitude

return (dist < RANGE)
end

function haveCheck(part)
for index, child in pairs(SELECTED) do
if child == part then
return true
end
end

return false
end

function canUse(part)
if part == nil then
return false
end

local bool = false

bool = (bool or lockCheck(part))
bool = (bool and distanceCheck(part))

return bool
end

function clearList()
SELECTED = {}

updateList()
end

function deleteList()
for index, child in pairs(SELECTED) do
child:remove()
end

clearList()
end

function creationChoice(tab)
CHOOSING = true

local chosen = nil

local x = 0
local y = 0

for index, child in pairs(tab) do
local newButton = Instance.new("TextButton")
newButton.Name = "ChoiceButton"
newButton.Size = UDim2.new(0, 100, 0, 25)
newButton.Position = UDim2.new(0, (400 + x), 1, (-301 + y))
newButton.Text = child

newButton.MouseButton1Down:connect(function()
chosen = child
end)

newButton.Parent = SCREEN_GUI

y = y + 25

if y > 100 then
y = 0
x = x + 100
end
end

while chosen == nil do
wait()
end

stopCreationChoice()

return chosen
end

function stopCreationChoice()
local buttons = SCREEN_GUI:GetChildren()

for index, child in pairs(buttons) do
if child.Name == "ChoiceButton" then
child:remove()
end
end

CHOOSING = false
end

--BUTTON FUNCTIONS
function clearSelected()
if CHOOSING then return end

clearList()

alert("Ingredients cleared")
end

function createTool()
if CHOOSING then return end

local made = nil

for index, child in pairs(TOOL_TABLE) do
made = runIngredients(child)

if made ~= nil then
break
end
end

if type(made) == "table" then
made = creationChoice(made)
end

if made == nil then
alert("Nothing created")
clearList()
else
alert(made.." created!")

giveTool(made)

deleteList()
end
end

function giveTool(name)
local player, char = getPC()
local backpack = player.Backpack
local tools = game.Lighting.Tools

local made = tools:findFirstChild(name)

if made ~= nil then
made:clone().Parent = backpack
else
alert("Davidii messed up")
end
end

function createItem()
if CHOOSING then return end

local made = nil

for index, child in pairs(ITEM_TABLE) do
made = runIngredients(child)

if made ~= nil then
break
end
end

if type(made) == "table" then
made = creationChoice(made)
end

if made == nil then
alert("Nothing created")
clearList()
else
alert(made.." created!")

giveItem(made)

deleteList()
end
end

function processItem()
if CHOOSING then return end

local processMessage = nil
local processFunction = nil

for index, child in pairs(PROCESS_TABLE) do
processMessage, processFunction = runIngredients(child, true)

if processMessage ~= nil then
break
end
end

if processMessage == nil and processFunction == nil then
alert("Nothing happened")

clearList()
else
alert(processMessage)

processFunction()

clearList()
end
end

function giveItem(name)
local player, char = getPC()
local pack = player.Pack
local items = game.Lighting.Items

local real = items:findFirstChild(name)

if real ~= nil then
local new = real:clone()
new.Parent = pack
else
alert("Davidii messed up")
end
end

--MOUSE FUNCTIONS
function onMouseMove(mouse)
if CHOOSING then return end

local targ = mouse.Target

TARGET_LABEL.Text = ""

if canUse(targ) then
TARGET_LABEL.Text = targ.Name
end
end

function onButton1Down(mouse)
if CHOOSING then return end

local targ = mouse.Target

if canUse(targ) then
if not haveCheck(targ) then
selectTarget(targ)
else
alert("You already have that!")
end
end
end

function selectTarget(part)
alert(part.Name.." selected")

table.insert(SELECTED, part)

updateList()
end

--SELECTION FUNCTIONS
function onSelected(mouse)
local player, char = getPC()
local pg = player.PlayerGui

SCREEN_GUI.Parent = pg

mouse.Move:connect(function()
onMouseMove(mouse)
end)

mouse.Button1Down:connect(function()
onButton1Down(mouse)
end)
end

function onDeselected(mouse)
SCREEN_GUI.Parent = TOOL

stopCreationChoice()
end

--CONNECTIONS
TOOL.Selected:connect(onSelected)
TOOL.Deselected:connect(onDeselected)

CLEAR_BUTTON.MouseButton1Down:connect(clearSelected)
ITEM_BUTTON.MouseButton1Down:connect(createItem)
TOOL_BUTTON.MouseButton1Down:connect(createTool)
PROCESS_BUTTON.MouseButton1Down:connect(processItem)
Report Abuse
wazup07 is not online. wazup07
Joined: 17 Oct 2009
Total Posts: 313
05 Aug 2013 04:25 PM
Who in their right mind is going to search endlessly through that....
Report Abuse
icegroudon is not online. icegroudon
Joined: 08 Oct 2011
Total Posts: 2924
05 Aug 2013 04:26 PM
wtl;dr
Way Tool Long ; Didnt Read
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
05 Aug 2013 04:34 PM
Hmm.. The phrases do look like the Survival 303's. Are you sure this code is yours?

Someone at this level should be able to tell us the code he added and the output...
Report Abuse
AZombieSurvivalist1 is not online. AZombieSurvivalist1
Joined: 07 Dec 2012
Total Posts: 17
13 Aug 2013 05:11 PM
{

{"Large Wood", "Large Wood", "Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall","Wall","Wall", "Wall", "Wall", "Wall", "Glass", "Glass", "Glass", "Glass", "Glass", "Glass", ""},
"Small Skyscraper"
},

{

{"Large Wood", "Large Wood", "Large Wood", "Large Wood", "Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Wall", "Glass", "Glass", "Glass", "Glass", "Glass", "Glass", ""},
"Mansion"
},


{

{"Wall", "Wall", "Wall", "Med Foliage", "Small Foliage", ""},
"2 Story Hut"
},

{

{"Med Rock", "Med Rock", "Wall", "Med Foliage", "Small Foliage", ""},
"2 Story Stone Hut"
},

{

{"Wall", "Wall", "Wall", "Wall", "Med Foliage", "Med Foliage", ""},
"Small House"
},

{

{"Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Large Foliage", "Med Foliage", ""},
"Med House"
},

{

{"Large Wood", "Large Wood", "Large Wood", "Wall", "Wall", "Wall", "Wall", "Wall", "Large Foliage", "Med Foliage", "Glass", "Glass", ""},
"2 Story House"
},

==========================================================================================
This is all the stuff I added prior to the tool breaking. I also messed with the dwait value a little too. I also made the map bigger, with another ocean area, and some other stuff like a volcano and a large island. The volcano was made of a lot of bricks, and has its own scripting for the lava, while the island is also a bit big.
Report Abuse
AZombieSurvivalist1 is not online. AZombieSurvivalist1
Joined: 07 Dec 2012
Total Posts: 17
13 Aug 2013 05:12 PM
The problem is that the Craft GUI isn't coming up.
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
13 Aug 2013 05:18 PM
I smell free models...
Report Abuse
MaximumMinimizer is not online. MaximumMinimizer
Joined: 26 May 2013
Total Posts: 1629
13 Aug 2013 05:34 PM
you fix it by shaking it harder i think maybe its a prostate problem

http://www.youtube.com/watch?v=g4tG8SfKn_I
"min pik er en lang at brøndby strand"
bro my pik's this long too, ur tissemand's smaller than ur thumb lol
Report Abuse
AZombieSurvivalist1 is not online. AZombieSurvivalist1
Joined: 07 Dec 2012
Total Posts: 17
13 Aug 2013 06:09 PM
The map was uncopylocked, and I wanted a place so my friends and I could play a survival game like Survival 404 without the noobs. That is how I got this.

Do you have a problem with free models?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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