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

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

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)

2 comments

0

put if otherPart.Name == workspace.detector.Name then

0

doesn't work. still just nils

1 answer

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

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