Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

.Activated Wont work?

Asked by
iLegitus 130
9 years ago
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

Log in to vote
1
Answered by
DataStore 530 Moderation Voter
9 years ago

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
Ad

Answer this question