how would i make it to use all of the formulas in te table
local m = game.Workspace.E yes = {m.Circle,m.hallleave} local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(Key) if Key.KeyCode == Enum.KeyCode.E and (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - yes.Position).magnitude <= 15 then print("Test Succesful") end end)
im not so sure of what you want, but if you'd want to check the magnitude between each value in the array and the player's character you can iterate through the array. also you should be using local variables as the variable defined as the array is on the highest scope.
local thing = game.Workspace.E local array = {m.Circle, m.hallleave} local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(key) if key.KeyCode = Enum.KeyCode.E then for _,v in pairs(array) do local distance = (game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.Position - v.CFrame.Position).magnitude -- v is the value its looping through if distance <= 15 then print("Test Succesful") break -- breaks the loop end end end end)