You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want the model to follow the cursor when it hovers the gridparts.
-
What is the issue? It doesn’t seem to follow the cursor. [video]
-
What solutions have you tried so far? I tried looking for posts similar to this, but most of them are not applicable to my situation.
local model = game.ReplicatedStorage["Basic Cubicle"]
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Move:Connect(function()
local raycastresult = workspace:Raycast(mouse.Hit.Position + Vector3.new(0,150,0),Vector3.new(0,-250,0))
if raycastresult ~= nil then --
if raycastresult.Instance.Name == "GridPart" then
print(raycastresult.Instance.Name) -- WORKS
model:SetPrimaryPartCFrame(CFrame.new(raycastresult.Instance.Position))
end
end
end)
mouse.Button1Down:Connect(function()
local raycastresult = workspace:Raycast(mouse.Hit.Position + Vector3.new(0,150,0),Vector3.new(0,-250,0))
if raycastresult.Instance.Name == "GridPart" then
local p = model:Clone()
p.Parent = workspace
p:SetPrimaryPartCFrame(CFrame.new(raycastresult.Instance.Position))
end
end)