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

How to create part in the workspace on the mouse click hit position?

Whatever Player clicks somewhere on the screen with the mouse, LocalScript should get an mouse hit position and create an part, then whatever the Player clicks again, the part will be placed in the mouse click position in the Workspace. Like in the game has in Tower Defense Simulator

I've tried this code in LocalScript

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local HitPos = nil

Mouse.Button1Down:Connect(function()
	HitPos = Mouse.Hit
	-- I dont know what to do after this :/
end)

2 comments

0

Thank You!

1 answer

✓ Accepted answer
p = Instance.new("Part",workspace)
p.Position = hitpos

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