I'm trying to create a building tool with a destructible system so I need instance.new to stick to the baseplate via studs but it's not doing that here's my script:

local tool = script.Parent
local events = tool.Events
local eventPlace = tool.Events:WaitForChild("place")


local partCount = 0

local part
local parts = {
}
--important
function EventPlace(player, p)
	partCount = partCount+1
	parts[tostring(partCount)] = Instance.new("Part",workspace)
	--parts[tostring(partCount)].Parent = 
	parts[tostring(partCount)].Position = Vector3.new((p.x)-(p.X)%0.5,p.y+0.6,(p.Z)-(p.Z)%0.5)
	parts[tostring(partCount)].Name = tostring(partCount)
end

eventPlace.OnServerInvoke = EventPlace

2 comments

0

Can you tell us the value of p?

0

its a mouse.Hit