✓ Accepted answer
-mouse.Hit.p is a Vector3 value. use x.Position instead of x.CFrame.
-Consider changing x to local x.
-Parts are blocks by default, no need to specify that.
-"game.Workspace" can be shortened to "workspace", in case you're feeling lazy.
-If you're making a tool (and not a HopperBin), you must have a part in the tool called "Handle".
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
n = script.Parent
function mold()
local x = Instance.new("Part", workspace)
x.Name = "Crystal"
x.Anchored = true
x.Size = Vector3.new(5, 5, 5)
x.Friction = 0.4
x.Position = mouse.Hit.p
end
n.Activated:connect(mold)
If you truly do not want your tool to have a handle, put this script in a HopperBin, and place the HopperBin in the StarterPack.
Player = game.Players.LocalPlayer
n = script.Parent
function onButton1Down(mouse)
local x = Instance.new("Part", workspace)
x.Name = "Crystal"
x.Anchored = true
x.Size = Vector3.new(5, 5, 5)
x.Friction = 0.4
x.Position = mouse.Hit.p
end
function onSelected(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
n.Selected:connect(onSelected)
4 comments
Please use the Code block. It's on the very right of the icons you see above while editing. Paste the script in between the lines that appear. "~~~"
Do you have a part in your tool named handle?
Nope.
If you didn't have a part named Exactly Handle then it will not work. You need a part called Handle for the tool to work. Does the script work then?