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

Error Within my script. no problems in developer console What do i do to fix this?

Script:

local debounce = false

function noclout() debounce = true if game.Workspace.DoorPartOne.Anchored == true then script.Parent:Play() wait (7) debounce = false end end

game.Workspace.JitterOne:Connect(noclout)

No clue why this doesnt work How do i fix this?

3 comments

1

Can you explain what JitterOne is? Also, put your script as a lua code, so we can read it faster.

0

Is this supposed to be an Touched function?

0

If so, just change game.Workspace.JitterOne:Connect(noclout) to game.Workspace.JitterOne.Touched:Connect(noclout)

1 answer

One error with this is your use of a debounce. A debounce needs to be checked it's value at the start of each group of code you want to run inside of a function.

Another error is that you have game.Workspace.JitterOne:Connect(noclout) which needs some sort of action such as Touched in order to do something.

local debounce = false

function noclout() 
	if debounce == false then --You need to check debounce's value before your code to use it
		debounce = true 
		if workspace.DoorPartOne.Anchored == true then 
			script.Parent:Play() 
			wait(7) 
		end 
		debounce = false --I would change debounce out side of the if statement incase it isn't anchored and you anchor it in game or something
	end
end

workspace.JitterOne.Touched:Connect(noclout) --I'm assuming if you want when it is touched? 
--You need some sort of action in order to connect to a function using Connect

If I have helped answer your question please remember to accept my answer. If I have messed up please feel free to message me or comment on my answer for what I could have done better. Thanks!

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