Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Kuzx 22
7 years ago

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

Log in to vote
0
Answered by 7 years ago

Thats probably one of the annoying parts of mouse stuff.

Do:

Mouse.TargetFilter = (the model your positioning)
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? Kuzx 22 — 7y
0
Set it to tower at the very beginning of the script NexanianStudios 91 — 7y
1
Thanks for the help, Working now Kuzx 22 — 7y
Ad

Answer this question