So this script lets a player place a table after they click the script.Parent but when you select it, you can place all the tables you want. How can I make it so that you only can place one table when you click the parent?
grid = 3 grid2 = 6 local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() mouse.Button1Down:connect(function() local Spawn = game.Workspace.start local Pos =(Vector3.new((mouse.Hit.p.X+grid) - (mouse.Hit.p.X+grid)%grid2, (Spawn.Position.Y+0.5), (mouse.Hit.p.Z+grid) - (mouse.Hit.p.Z+grid)%grid2)) --tree stump local part = game.ReplicatedStorage.Table:Clone() part.Position = Pos part.Parent = game.Workspace print("Table Placed") end)
Create a new function and put the intended function of what would happen when clicking on the script.Parent. Now, create a new variable and set it to zero. Inside the function where you would click, create an if statement. If the Variable equals zero, then set it to one and call the function, which is meant to create a new table. However, if it's already equal to one, then end mouseclick function and do not call the function that would place a table
If you need further help or an example, please tell me.