Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Positions and Vector3?

Two errors with this script.

It doesn't change the position of the new parts. And. It doesn't add 1 to the logs cut value.

script.Parent.Touched:connect(function(hit)
		if hit.Name == "Log" then
			planks = hit.Planks.Value
		for i = 1, tonumber(planks) do
			part = Instance.new("Part", Workspace)
			part.BrickColor = hit.BrickColor
			part.FormFactor = "Custom"
			part.Size = Vector3.new(hit.Size.X/5 ,hit.Size.Y, hit.Size.Z/2)
			part.Rotation = Vector3.new(90, 90, 0)
			part.Position = Vector3.new(hit.Position)
			part.TopSurface = "Smooth"
			part.BottomSurface = "Smooth"			
			hit:Remove()
		end
		game.Workspace.LogsCut = game.Workspace.LogsCut + 1
	end
end)

1 comment

0

Fixed 2nd error with a tonumber(--code)

1 answer

✓ Accepted answer

I am assuming "Hit" is a Part.

Now, "Hit" has a Vector3 Value Position. Since you are copying that value from the part "Hit" is is not a new Vector3.

Just change Line 10 to this and it should function properly.

part.Position = hit.Position

Hope I helped. :)

2 comments

0

Hmm thanks! I thought everything had vector3 by it if it was a position, size, etc.

0

Well it IS a Vector3, but you just aren't creating a new one, so Vector3.NEW <-- Point Point would be creating a new one. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.