I'm making a Tower Defense game, and I'm trying to make a Tower place on the ground, and certain parts of it, but it wont work. Anyone able to help?
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() enabled = false function onClick() if game.ReplicatedStorage.Stats.Cash.Value >= 170 and enabled == false then enabled = true game.ReplicatedStorage.Stats.Cash.Value = game.ReplicatedStorage.Stats.Cash.Value - 170 local tower = game.ReplicatedStorage.Towers.DartPart:Clone() tower.Parent = workspace.Towers while enabled do wait() mouse.TargetFilter = workspace.Land tower.PrimaryPart = tower.Part wait() tower:SetPrimaryPartCFrame(mouse.Hit*CFrame.Angles(math.pi/2,0,0)*CFrame.new(0,-1,0)) end end end script.Parent.MouseButton1Click:connect(onClick)
(i'm fully aware it needs to be FE converted, im doing that later)