I want to make a system in which you click on a Rock that throws Stone in certain squares, but that a square cannot have more than one stone
But the problem is that I have no idea how to make the stones select a box in which to put, and that these do not repeat, the only thing I manage to do is to make them spawn in the same position as always
Well I tried to search the dev forum how to make parts spawn in random places and try to adapt them to my script, without any result …, and then I tried to create some cells in which the place where each object goes with a value inside that says if they are available, but I could not do anything with my little knowledge about this …
this is te script in te Droper (basically I have nothing because as I said I have no idea what to do to achieve this, so I ask if you know of any way you can help me do it)
local click = script.Parent.ClickDetector
local Droper = script.Parent
function onMouseClick()
local newitem = game.ServerStorage.Items.Stone:Clone() --Clone stone to drop
newitem.Parent = game.Workspace.Items
newitem.Position =
end
click.MouseClick:Connect(onMouseClick)
and the spawns script is basically a touch event and a touch ended that searches if something touched it to determine if it is occupied or not.
local Holder = script.Parent
local function onTouch(Tocuhed)
if Tocuhed.Name == "Stone" then
Holder.HasItem.Value = true
end
end
local function OffTouch(Nop)
Holder.HasItem.Value = false
end
Holder.Touched:Connect(onTouch)
Holder.TouchEnded:Connect(OffTouch)
thanks for your attention and I hope someone knows how you could help me