i have a while loop that calls the same function twice, but with a different arg, and when i call the function a 2nd time, i get an error “Attempt to call a boolean value”
while true do
local OnScreen = OnScreen(StalkNPC.Torso)
local OnScreenC = OnScreen(CampingNPC.PrimaryPart)
--other stuff
end
i dont think the function is needed but if it is ask
1 Like
You are creating a variable with the same name as the function.
while true do
local OnScreen = OnScreen(StalkNPC.Torso) -- OnScreen variable is the same as function name
local OnScreenC = OnScreen(CampingNPC.PrimaryPart)
--other stuff
end
Try renaming the OnScreen function or change the variable like this:
while true do
local _OnScreen = OnScreen(StalkNPC.Torso) -- notice i added a underscore, it should work now
local OnScreenC = OnScreen(CampingNPC.PrimaryPart)
--other stuff
end
2 Likes
how did i not realize that bruh
1 Like