This code is in a Local Script in a tool. It should create parts at the location of the mouse with the Object Hearts as a child of it. It creates the part with the child, but it spawns at 0,0,0. Any ideas?
local tool = script.Parent local player = game.Players.LocalPlayer local mouse = player:GetMouse() local function onActivate() local character = tool.Parent local hit = mouse.Hit.p local part = Instance.new("Part", character) local hearts = tool.Hearts:Clone() part.Anchored = true part.Size = Vector3.new(1, 1, 1) part.CanCollide = false part.Position = Vector3.new(hit) hearts.Parent = part end tool.Activated:connect(onActivate)
mouse.Hit.p is already a Vector3, so you would want to either do CFrame.new(mouse.Hit.p) or do position = mouse.Hit.p
do part.CFrame = CFrame.new(hit) it should work for u since cframe changes the position of an object and i think ur getting position 0,0,0 since i believe thats where parts spawn if u dont change the position