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

How can I make a gear that changes a variable? [SOLVED]

Asked by 6 years ago
Edited 6 years ago

I'm trying to make a gear that changes a variable when it touches the detector brick. I set up a script to print the variable, but even after the gear touches the detector, it prints "nil". Can someone help?

function touched(otherPart)
    if otherPart.name == game.Workspace.detector then
        _G.gearInside = true
    end
end

script.Parent.Parent.Touched:connect(touched)
0
put `if otherPart.Name == workspace.detector.Name then` creeperhunter76 554 — 6y
0
doesn't work. still just nils JarFullOfMayonnaise 48 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

I needed to detect the handle, not the gear. Thank you to saSlol2436 and creeperhunter76 for helping me.

Ad

Answer this question