Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

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?

1
Can you explain what JitterOne is? Also, put your script as a lua code, so we can read it faster. dionant 23 — 7y
0
Is this supposed to be an Touched function? PyccknnXakep 1225 — 7y
0
If so, just change game.Workspace.JitterOne:Connect(noclout) to game.Workspace.JitterOne.Touched:Connect(noclout) PyccknnXakep 1225 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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!

Ad

Answer this question