I am making a kind of paleontology game that requires you to mine up chunks of fossil. I learned via a video and was able to get it to work, but when I tried to set it up to use custom parts that I made for this piece, the whole tool would not work. This is the script that I have set up at the moment. The less than 30 section is what I was working on at the moment, and the rest is still the original section.
local tool = script.Parent
local canMine = false
local function onTouch (otherPart)
if otherPart.name == 'Fossil Chunk' and canMine then
canMine = false
local minedPart = Instance.new('Part')
minedPart.Parent = game.Workspace
minedPart.Size = Vector3.new(2,1,2)
minedPart.Position = otherPart.Position + Vector3.new(math.random(-5,5), 5, math.random(-5,5))
local mineType = math.random(1,100)
if mineType < 30 then
local Object = game.ReplicatedStorage:WaitForChild("ObjectName")
local ObjectSpawn = game.Workspace:WaitForChild("ObjectSpawn")
local CloneObject = Object:Clone()
CloneObject.Parent = game.Workspace
CloneObject.CFrame.p
end
end
if mineType > 30 and mineType < 50 then
minedPart.BrickColor = BrickColor.new('Black')
end
if mineType > 50 and mineType < 70 then
minedPart.BrickColor = BrickColor.new('Gold')
end
if mineType > 70 and mineType < 85 then
minedPart.BrickColor = BrickColor.new('Teal')
end
if mineType > 85 then
minedPart.BrickColor = BrickColor.new('Dark green')
end
end
end
local function slash()
local str = Instance.new("StringValue")
str.Name = "toolanim"
str.Value = "Slash"
str.Parent = tool
canMine = true
end
tool.Activated:Connect (slash)
tool.Handle.Touched:Connect (onTouch)
I am not sure on how to fix this, and the errors pop up on CloneObject.CFrame.p stating that it is an incomplete statement and it expected an assignment or function call. I am still a beginner at scripting for Roblox, so I am next to clueless on how to fix this.

2 comments
It seems that a new error appeared after fixing the last error. This error says at line 33, it expected , but got end. I am not quite sure on how to get that in, since when I type either end of file, end of function, or simply eot, it pops up as an error saying that this is an incomplete statement.
Alright, one moment i see whats wrong