I want it to be like infinite placement
so I when I place and im able to place more its for a tower defence game
becasue right now it just places and when i try to place another i just resets and deleltes the one i placed and puts a new one.
local RS = game.ReplicatedStorage
local event = RS:WaitForChild("Tower")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Captin = RS.Towers.HeroCaptin
local Clone = Captin:Clone()
local Placeing = false
script.Parent.MouseButton1Click:Connect(function()
Clone.Parent = workspace
Clone.BrickColor = BrickColor.new("Plum")
Clone.Transparency = 0.7
Placeing = true
end)
mouse.Move:Connect(function()
if Placeing == true then
Clone.Position = mouse.Hit.p + Vector3.new(0, 1, 0)
mouse.TargetFilter = Clone
end
end)
mouse.Button1Up:Connect(function()
if Placeing == true then
Clone.BrickColor = BrickColor.new("Medium stone grey")
Clone.Transparency = 0
Placeing = false
end
end)
Probably because of this part. You’re only cloning it once, meaning that you’re only changing the property of one object.
To fix that, you could try making a new clone every time a MouseButton1Click() event is fired.