Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a "crafting" brick (A brick that will change a tool into another tool)?

Asked by 10 years ago

So I'm making an RPG game that involves mining. Once a player mines an iron vein he/she receives a tool. That tool is called "IronOre". It's a tool that is composed of simply a handle and that's it. I want to make a furnace that has a brick. Now I want that brick to have a "clickdetector" so a player can click on the block and a gui will pop up and the player can select an option that will "smelt" the "IronOre" into an "IronBar". I have no idea on how to do this xD Please help? I will be very grateful for your kindness.!

I already have the block with click detector and the gui and stuff.

What I tried putting inside of my button that is inside of my gui. (i know it was a complete fail :( but what do i do? oh and by the way, the "IronOre" and "IronBar" are in Lighting):

function Onclicked ()
    if player.Backpack.("IronOre")
        then player.Backpack.destroy ("IronOre")
        and give.player.Backpack ("IronBar")
    end
end

0
Can you post code you have tried? ultrabug 306 — 10y
0
You might need to use conditional statements, aswell as some ternary operators. yurhomi10 192 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
--Put this in the brick that is the furnace brick

script.Parent.ClickDetector.MouseClick:connect(function(player)
if player.Backpack.IronOre
then player.Backpack.IronOre:Destroy()
--Put your ironbar tool in lighting
ModelCopy=game.Lighting.IronBar:Clone()
        ModelCopy.Parent=plr.Backpack

--Im just a novice, if it doesn't work just say and I will remove this.

Ad

Answer this question