I'm making an ATM machine for a roleplay game I'm working on. I made an "E to interact" and it worked with print so I replaced it with making the ATM Gui visible. It didn't work and there wasn't errors. I tried debugging and it came out positive. My code is a LocalScript:
local HumanoidRootPart = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
local Atm = game.Workspace.Atm
UIS.InputBegan:Connect(function(keyCode)
if keyCode.keyCode == Enum.KeyCode.E then
if (Atm.Position - HumanoidRootPart.Position).magnitude <10 then
game.StarterGui.ScreenGui.FinnianATM.Visible = true
print("Worked")
end
end
end)

1 comment
The error that I assume is on line 7, where it talks about the ATM. You can't get the ATM position, you can only get the position of one part inside of the ATM, considering if it's a model or not. If it is a model, make a HitBox part that is the size of the ATM and make it transparent, and no Collidable and then use that position for the magnitude.