Basically i'm trying to create a new part based on which existing part collides with my "Drill" part and after awhile i came up with this
local myPart = script.Parent
local otherPart = myPart.Touched
local stoneOre = game.ServerStorage["Stone_\"Ore\""]
local location = game.Workspace.BasicDrill.Dropper
local colliding = false
local printStonee = false
function onTouched(otherPart, colliding) ---- Finding out what part is touching the Drill
if otherPart.Name == "Stone" then
printStonee = true ---- Trying to invoke the while statement
elseif otherPart.Name == "Coal" ---- Not important
then
end
local function notTouched() ---- Trying to dissable the invoked statement when collision ends
printStonee = false
end
myPart.Touched:Connect(onTouched) ---- To handle when the Drill is touched
myPart.TouchEnded:Connect(notTouched) ----- To handle when the Drill ends its collison
while printStonee == true do ---- Continuously creating new parts when statement is true
local newBlock = stoneOre:Clone()
newBlock.Parent = location
newBlock.Size = Vector3.new(1,1,1)
end
end
When I connect the "Stone" part to the "Drill" nothing happens no errors or anything. My script is located in the "Drill".The "Stone" part is in a folder in server storage but is copied into a folder in the Workspace. The new part or "StoneOre" is also located in Server storage and has no dedicated folder in the Workspace. The script is a server script. I've tried making it get invoked after setting printStonee to true.
