Specifically the GUI only interacts with one door, not all of them

Hi! Im currently trying to make a door that functions when the player presses ‘E’, everything works except for the GUI popping up when the player gets near.

The GUI seems to only want to pop up for only one door. There are three door types, although this information doesn’t matter, Up, Left, and Right.

Here is the block of code in question:

RunService.Heartbeat:Connect(function(delta)
	local rootpart = Player.Character:WaitForChild("HumanoidRootPart")
	local humanoid = Player.Character:WaitForChild("Humanoid")
	for _, radius in ipairs(workspace:GetDescendants()) do
		if radius.name == "DoorRadius" then
			if (rootpart.Position - radius.Parent.Position).Magnitude <= radius.Value then
					guiMenu.Enabled = true
			else
					guiMenu.Enabled = false
			end
		end
	end
end)
2 Likes

are you trying to make the gui menu appear when the player is near a door?
and is this a local script?

yes and yes (more words to take up space because yes)

Nevermind, I figured out the issue. This is so dumb, but I was missing a return statement after line 7 so It didnt “fixated” on that one item in the list.

For anyone curious what a return statement does, visit this link: Programming in Lua : 4.4

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