How do I make a tower placement system for my tower battle game?

Hi, I am currently making a game like tower battle, I created the entrance, base’s health and moving enemies, now I move to the next step

  1. What do you want to achieve? I want to make a placement system for my game ( place towers so they could defense the base)

  2. What is the issue? I don’t know how to do it, I tried and it was very messy

  3. What solutions have you tried so far? What I did so far is create a tower slot GUI and placeable areas (I group them in a folder) , I watched some tutorials from BOSS METRO but it didn’t work for me and I’m tired of rewriting script, I just want a more simple way to create the placement system
    sorry for my bad grammar

1 Like

you could use mouse.Move or use raycast to detect the mouse point and then you can place it but i think raycast is better as mouse.move makes it that you wont have limit for distance from player while raycast you can do limit

3 Likes

You can simply add magnitude check and I think you mean Mouse.Hit.Position rather than Mouse.Move although I wouldn’t recommend OP using old legacy mouse, I would rather recommend to use open sourced custom mouse modules (that are using raycasting and UIS anyways) or use raycasting as you said.

1 Like

yes i actually meant mouse.hit.position also i never knew you could use magnitude lol

1 Like

Yes you actually can because Mouse.Hit.Position will return Vector3 so you can do something like.

local Mag = (Mouse.Hit.Position - player.Character.HumanoidRootPart.Position).Magnitude
local Allowed = 30
if Mag < Allowed then
print("Allowed distance") 
end
1 Like