So as you can see from the title, I am trying to make a tool that spawns a part. I have made it so it cant be spammed crashing the server in under a second but it just wont spawn anything . Here u have my code
local JustSpawned = false
local Tool = game.StarterPack.SandTool
local Player = game:GetService("Players").LocalPlayer;
local Mouse = Player:GetMouse();
function draw()
local Sand = Instance.new("Part")
Sand.Anchored = false
Sand.Size = Vector3.new(0.1,0.1,0.1)
Sand.BrickColor = BrickColor.new("Sand yellow")
JustSpawned = true
wait(1)
JustSpawned = false
end
if Tool.Equipped then
if JustSpawned == false then
Mouse.Button1Down:connect(function() draw() end)
end
end

4 comments
I don't even know if I'm right, actually I 99% doubting myself, but you are trying to spawn a part for everyone from a local script. I don't think it works like that. But I'm probably wrong.
Also what are you trying to spawn? Maybe I can give you a better way of doing it.
Im trying to spawn a little cube which is unanchored and is kinda like a sand particle
What type of script - is it a sever or is it a client? Anything on the output? Has the Sand been parented to workspace or somewhere else? Is it supposed to spawn for all players or is it for the player that holds the tool only? (Since it was kinda unclear)