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

Script not changing BoolValues when prompted?

Any idea why newCheck and posCheck do not change when prompted?

newCheck = script.Parent.New
posCheck = script.Parent.Parent.Window.Detect.Bool
greenLight = script.Parent.Parent.Window.pRemain
detector = script.Parent.Parent.Window.Detect
finish = script.Parent.Parent.Window.End

if newCheck.Value == true then
	script.Parent.Humanoid:MoveTo(detector.Position, detector)
end
	
function detection(hit)
	newCheck.Value = false
	posCheck.Value = true
	if greenLight == 0 then
		script.Parent.Humanoid:MoveTo(finish.Position, finish)
	end
detector.Touched:connect(detection)
end

1 comment

1

Never mind my solution. What you had was right. It actually appears that the MoveTo function is not properly working at the moment.

1 answer

This might work? Worth a try

newCheck = script.Parent.New
posCheck = script.Parent.Parent.Window.Detect.Bool
greenLight = script.Parent.Parent.Window.pRemain
detector = script.Parent.Parent.Window.Detect
finish = script.Parent.Parent.Window.End

if newCheck.Value == true then
    script.Parent.Humanoid:MoveTo(detector.Position, detector)
end

function detection(hit)
    newCheck.Value = false
    posCheck.Value = true
    if greenLight == 0 then
        script.Parent.Humanoid:MoveTo(finish.Position, finish)
    end
end
detector.Touched:connect(detection) -- put event listener outside function

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