I try to make a bag which u can pickup but the variable does not update so when the bag moves you cannot pick it up anymore becouse the variable is stuck on 1 coordinate point anyone help with the Mag variable?
inputservice.InputBegan:connect(function(i,g)
if i.UserInputType == Enum.UserInputType.Keyboard then
if i.KeyCode == Enum.KeyCode.F then
for _,Door in pairs(workspace.Shops:GetChildren()) do
local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude
if Mag <= Door.Range.Value then
Door.Event:FireServer()
break
end
end
end
end
end)

3 comments
Are you trying to reassign a variable, or...
im trying to make it update for when the brick moves it changes the coordinate
you can use while wait() do