Player = game.Players.LocalPlayer mouse = Player:GetMouse() CB = script.Parent function placeBlock() x = Instance.new("Part", game.Workspace) x.Name = "IronBlock" x.Material = "Metal" x.Size = Vector3.new(4, 4, 4) x.Friction = 0.3 x.Shape = "Block" x.FormFactor = Custom x.CFrame = CFrame.new(x.Position,mouse.Hit.p) end CB.Activated:connect(placeBlock)
Basically this is in a Localscript,And the local script is inside a tool. I want it to spawn the block wherever the player's mouse is facing,Could anybody help?
The blocks aren't being created due to an issue on line thirteen. This is because Custom is a nil value and thus not a valid Enum for the FormFactor property.
Using either of the two lines shown below will fix the issue of the blocks not spawning.
x.FormFactor = "Custom"
x.FormFactor = Enum.FormFactor.Custom