I am currently creating Items that will be portable throughout the game however whenever I get to the actual placements, there is always a nil error in which I am not entirely sure of it's meaning.
game.ReplicatedStorage.pebench.OnClientEvent:Connect(function(player,bench)
local pl = game.Players.LocalPlayer
local mouse = pl:GetMouse()
local ntarget
function OnMouseClick()
if mouse.Target ~= nil then
ntarget = mouse.Hit
print(ntarget)
mouse.TargetFilter = ntarget
print(mouse.TargetFilter)
end
end
mouse.Button1Down:Connect(OnMouseClick)
function MouseMoved()
while true do
bench:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z))
wait(2)
end
end
mouse.Move:Connect(MouseMoved)
function OnPlace()
ntarget:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z))
ntarget.Parent = game.Workspace
end
mouse.Button2Down:Connect(OnPlace)
end)
Error is on lines 60 and 62
Any help is appreciated, thank you! :D
