Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do i make this script work?

d = true

function onClick()
	script.Parent.BrickColor = BrickColor.new("Really red")
	if d == true then
	local q = Instance.new("Part",workspace)
	q.Size = Vector3.new(1,1,1)
	q.Position = Vector3.new(-213.7, 4.5, 8.9)
	q.BrickColor = BrickColor.new("Lapis")
	else print("NOOOOO")
		end
	d = false
	wait(3)
	d = true
	script.Parent.BrickColor = BrickColor.new("Lime green")
		end

script.Parent.ClickDetector.MouseClick:connect(onClick)

it works, just not reliably. its supposed to create the part, wait 3, then allow for the part to be created again. uts hard to explain waht happens. put a click detecter in a part, put this script in it, and when you click it look for parts in the workspace. i'ts late where i am, and i have thoroughly exhausted all my brainpower. please fix this.

2 comments

0

This is not a request site. By saying "please fix this" you are asking us to do your work for you.

2

im asking you to HELP me with scripting, much like being a scripting HELPer, and scripting HELPers is the title of the site, im not asking for you to make a game for me, im asking for HELP

1 answer

✓ Accepted answer

You just had to move the parts that handle the debounce into the if statement.

d = true

function onClick()
    script.Parent.BrickColor = BrickColor.new("Really red")
    if d then
 d = false
    local q = Instance.new("Part",workspace)
    q.Size = Vector3.new(1,1,1)
    q.Position = Vector3.new(-213.7, 4.5, 8.9)
    q.BrickColor = BrickColor.new("Lapis")
    wait(3)
    script.Parent.BrickColor = BrickColor.new("Lime green")
    d = true
    else print("NOOOOO")
        end
        end

script.Parent.ClickDetector.MouseClick:connect(onClick)

1 comment

0

thank you, you were being very HELPful. (look in the comments for the question)

This discussion is preserved as it was. New answers, comments, and votes are closed.