How Could I Make A Method Won't Work Again When Called Once?

hi devs!, so i have this problem when im trying to make the pivoter to nil it won’t work also gives me an error. Because i want to check if the statement is met then i want to make the method won’t work again. If you’re confused so sorry bout that. Thanks

local pivoter
pivoter = Character:PivotTo(checkpoint["1"].CFrame + Vector3.new(0, 5, 0))
if stages.Value == 2 then
			print(pivoter)
			pivoter = nil
		else

what shows up when you print pivoter, and what is the error?

so sorry i meant it’ll just return nil dunno why even the stages.Value is not equal to 2

Where is the line 48 of this script?
Seems like it is not related to the code you provided…

1 Like

yeah i know but why it does give nil tho when i print the pivoter it’ll just print nil

Thats because the method PivotTo doesn’t return any value. (you have called the method already while setting up the variable)

ok so how do i make it won’t work again cuz i want to make the method only work once

You can make this variable as a function like

pivoter = function()
	Character:PivotTo(checkpoint["1"].CFrame + Vector3.new(0, 5, 0))
end

print(pivoter)
end

Thats the code. So what i want to do is to make the pivoter to nil but it says nil is not a value. But i want it to be nil so it won’t pivot again when im in the if statement. Thanks!

nvm guys i figure it out thanks for your time

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.