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

.Activated Wont work?

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?

1 answer

✓ Accepted answer

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

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