I have been trying to make a placement system and I have been trying for a while. I cannot find anything to stop it from moving.
Thanks for helping!
Code:
wait(0.01)
local model = game.Lighting.Handgunner
local input = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
input.InputBegan:connect(function(inp,GPE)
if inp.KeyCode == Enum.KeyCode.P then
model.Parent = game.Workspace.CurrentCamera
input.InputChanged:connect(function(ip)
if ip.UserInputType == Enum.UserInputType.MouseMovement then
local currentPos = model:GetPrimaryPartCFrame()
model:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,currentPos.Y,mouse.Hit.Z))
print("Movement Detected")
end
end)
end
end)

5 comments
BUT im not trying to set it into a certain spot im trying to make it like a TD placement system
But you are setting it to a certain spot, that's why you call :SetPrimaryPartCFrame(). I don't understand.
wait
it gives the error 'player is not a valid member of datamodel'
sorry it should be "Players"