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

Can I get some help with this?, Having Issues with CFrame Mouse.Hit.p?

Trying to make a Tower Defense game but having issues with the placing Towers part, So far I got it to work with Placing and what not. The issue is when your placing the Tower down, The Tower will slowly come back to you. Here's a better idea of what I mean https://gyazo.com/880037f825b78409e4678296f143c723

`while enabled do
wait()
mouse.TargetFilter = workspace.Land
tower.PrimaryPart = tower.Part
wait()
tower:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.p))
end
end
end
script.Parent.MouseButton1Click:connect(onClick)

function onClick2()
if enabled == true and mouse.Target.Name == "Land" then
enabled = false	
end
end
mouse.Button1Down:connect(onClick2)`

What I need help with is making it not move other then the player moving the mouse around to move the tower. I'm still new with CFrame.

1 answer

✓ Accepted answer

Thats probably one of the annoying parts of mouse stuff.

Do:

Mouse.TargetFilter = (the model your positioning)

3 comments

0

See I don't understand that, The Model is Land but it's still flying at the cam. Would SetPrimaryPartCFrame need to be set before or after TargetFilter?

0

Set it to tower at the very beginning of the script

1

Thanks for the help, Working now

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