Hello, i have always wondered, how could i do a simple crafting system. The crafting system would consist in using 2 parts and if those 2 parts touch each other they would make another part. Example: blue part touches yellow part = green part. You would drop those parts on each other and they would make a new part. Could you help me/give me any ideas?
1 Like
local part1 = game.Workspace.Part1
local part2 = game.Workspace.Part2
local part3 = game.ReplicatedStorage.Part3
part1.Touched:Connect(function(hit, player)
if hit.Name == "part2" then
part1:Destroy() -- Destroys both of the Parts
part2:Destroy()
local partOutput = part3:Clone() -- Clones Part, then moves it to player
partOutput.Parent = game.Workspace
partOutput.Position = player.Character.Torso.Position -- UpperTorso if R15
end
end)
This obviously will need polishing but this should work!
Part1 is your “blue part”, Part2 is your “yellow part” and Part3 is your “green part”.
Part1 and 2 need to be in Workspace and Part3 needs to be in ReplicatedStorage. Also please note that this should be a Server Script and it can be stored in Workspace or ServerScriptService.
3 Likes